我在C#中有一个textarea,请看下面的代码:
<asp:Label ID="lblQuestions" runat="server" CssClass="addinfo">
Question & Comments</asp:Label>
<asp:TextBox ID="txtQuestions" Rows="5" Columns="5" TextMode="MultiLine" runat="server" MaxLength="250"></asp:TextBox>
Run Code Online (Sandbox Code Playgroud)
现在我希望textarea不应该接受超过250个字符,无论用户做什么COPY&PASTE,通过WRITING和DRAG&DROP等,如果用户尝试复制或拖放超过250个字符,那么应该在textarea中复制前250个字符.我知道TEXTAREA中没有MAXLENGTH属性.如果使用.NET无法使用javascript或Jquery的解决方案.
请帮忙
我想在C#中重定向之前从Request.UrlReferrer.AbsoluteUri中删除Querystring部分.
例如,如果你有你的
Request.UrlReferrer.AbsoluteUri = "http://localhost:8080/english/index_2011.aspx?logout=true"
Run Code Online (Sandbox Code Playgroud)
现在我想
Response.Redirect(Request.UrlReferrer.AbsoluteUri) without QueryString part (?logout=true")
Run Code Online (Sandbox Code Playgroud)
请建议使用C#
我想用我的第一个TR替换第一个Colspan ="2"与Colspan ="4",而不是使用JQuery完成页面.
谢谢.
最诚挚的问候,MS
我有这些类型的hrefs
http://localhost:8080/en/reservations/tours-and-safaris-booking-enquiry-form/dubai/index.aspx
http://localhost:8080/en/reservations/tours-and-safaris-booking-enquiry-form/muscat/index.aspx
Run Code Online (Sandbox Code Playgroud)
现在我需要编写一个函数,将其作为输入,并返回"tours-and-safaris-booking-inquiry-form".
请建议!!
我正在使用XSLT1.0来转换我的XML.
我在Tabs.xml下面
<?xml version="1.0"?>
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" ID="tcm:481-87289-4" Managed="68">
<tcm:Item ID="tcm:481-596728-64" Title="T000. Brisbane" pageURL="/australia/brisbane/index.aspx" componentTitle="Overview"/>
<tcm:Item ID="tcm:481-598671-64" Title="Tabs XML"/>
<tcm:Item ID="tcm:481-598672-64" Title="T030 Special Offers" pageURL="/australia/brisbane/specialoffers.aspx" componentTitle="Special Offers"/>
<tcm:Item ID="tcm:481-598673-64" Title="020 Flight Schedules" pageURL="/australia/brisbane/flightschedules.aspx" componentTitle="Flight Schedules"/>
<tcm:Item ID="tcm:481-598674-64" Title="T010 Guide" pageURL="/australia/brisbane/guide.aspx" componentTitle="Guide"/>
</tcm:ListItems>
Run Code Online (Sandbox Code Playgroud)
我正在使用xslt以下来改造它!
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tcm="http://www.tridion.com/ContentManager/5.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:em="http://www.emirates.com/tridion/schemas" xmlns:tcmse="http://www.tridion.com/ContentManager/5.1/TcmScriptAssistant" exclude-result-prefixes="em xlink tcmse tcm">
<xsl:output method="xml" version="1.0" encoding="UTF-16" indent="yes"/>
<xsl:template match="tcm:ListItems">
<list type="Tabs">
<xsl:apply-templates select="tcm:Item">
<xsl:sort select="@Title" order="ascending"/>
</xsl:apply-templates>
</list>
</xsl:template>
<!-- add field values for each item-->
<xsl:template match="tcm:Item">
<xsl:if …Run Code Online (Sandbox Code Playgroud) 我正在使用XSLT和XML.
我和我一起得到了以下XML.
<?xml version="1.0" encoding="UTF-8"?>
<mappings>
<!-- News mapping -->
<mapping old="mbp" new="/SessionHandler.aspx?pageurl=/BP.aspx&pub=/english&section=IBE&j=f"/>
<mapping old="about/news" new="about/news/news.aspx"/>
<!-- CUGO's-->
<mapping old="/nhs" new="/cugo.aspx?promoCode=UKNHS01&pub=/uk/english"/>
<mapping old="/hk/ukstudentfare" new="/cugo.aspx?promoCode=HKSTU10&pub=/hk/Chinese"/>
<!-- Reserved below vanity URL's -->
<mapping old="/kgfmastercard" new=""/>
<mapping old="/mastercard" new=""/>
<!-- Other vanity URL's-->
<mapping old="/destinationbriefs" new="http://www.ekgroup.com/destinationbriefs"/>
<mapping old="/win" new="/ch/german/destinations_offers/win_two_tickets_on_A380.aspx"/>
<!--FIFA Fan Fest-->
<mapping old="/romefanfest" new="/it/italian/destinations_offers/rome_international_fifa_fan_fest.aspx"/>
<mapping old="/parisfanfest" new="/fr/french/destinations_offers/paris_international_fifa_fan_fest.aspx"/>
</mappings>
Run Code Online (Sandbox Code Playgroud)
下面是我正在使用的xslt
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="xsl fo">
<xsl:output method="xml" indent="yes" />
<xsl:template match="/">
<xsl:for-each select="mappings/mapping">
<VanityUrl>
<old>
<xsl:value-of select="@old" />
</old> …Run Code Online (Sandbox Code Playgroud) 当在IE和Firefox中阻止弹出窗口时,如何通过javascript打开新窗口.
以下是代码:
<%@ Page language="c#" AutoEventWireup="false" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>SessionRedirect</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body MS_POSITIONING="GridLayout">
<form method="post" name="frmRedirect">
<input type="hidden" name="email" value="<%=Session["Email"].ToString() %>" />
<input type="hidden" name="pass" value="<%= Session["PWD"].ToString() %>" />
<input type="hidden" name="User" value="<%= Session["User"].ToString() %>" />
</form>
<script type="text/javascript">
if(frmRedirect.User.value == "P")
{
window.open("", "Partner", "height=650,width=1075,left=100,top=100,status=1,scrollbars=1,location=1,toolbar=1;resizable=1");
frmRedirect.target="Partner";
frmRedirect.action = "http://pli.cmsstag/partnerzone/index.aspx";
document.frmRedirect.submit();
location.replace("index.aspx");
}
else
{
window.open("", …Run Code Online (Sandbox Code Playgroud) 我在VBSCript中有以下代码:
Function getFacilitiesNotes(objComp)
Dim strFacilities
strFacilities = strFacilities & "<div id =""facilities"">"
strFacilities = strFacilities & "<ul>"
For intCount = 1 to objComp.Fields.Item("Facilities").Value.Count
strFacilities = strFacilities & "<li>" & objComp.Fields.Item("Facilities").value(intCount) & "</li>"
Next
strFacilities = strFacilities & "</ul>"
strFacilities = strFacilities & "</div>"
getFacilitiesNotes = strFacilities
End Function
Run Code Online (Sandbox Code Playgroud)
在上面的函数中,代码strFacilities = strFacilities & "<li>" & objComp.Fields.Item("Facilities").value(intCount) & "</li>"在执行循环时可能具有以下类型的值.
1)ABC 2)DFG1 3)G231EG 4)REWEREW1 5)DSFWRE3 6)YRTRWER1
现在我想删除"1",如果它是循环中上面字符串中的最后一个字符.
请建议!!
我有以下updateFile代码,这里我试图在我的xml文件中没有publicationid时添加新节点.
public static void UpdateFile(String path, String publicationID, String url) {
try {
File file = new File(path);
if (file.exists()) {
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(file);
document.getDocumentElement().normalize();
XPathFactory xpathFactory = XPathFactory.newInstance();
// XPath to find empty text nodes.
String xpath = "//*[@n='"+publicationID+"']";
XPathExpression xpathExp = xpathFactory.newXPath().compile(xpath);
NodeList nodeList = (NodeList)xpathExp.evaluate(document, XPathConstants.NODESET);
//NodeList nodeList = document.getElementsByTagName("p");
if(nodeList.getLength()==0)
{
Node node = document.getDocumentElement();
Element newelement = document.createElement("p");
newelement.setAttribute("n", publicationID);
newelement.setAttribute("u", url);
newelement.getOwnerDocument().appendChild(newelement);
System.out.println("New Attribute …Run Code Online (Sandbox Code Playgroud) 我正在尝试编写并调用WCF Web服务,下面是详细信息:
Web.config文件:
<add relativeAddress="FetchData.svc" service="WCF.Services.FetchData" />
<service name="WCF.Services.FetchData">
<endpoint address="" binding="webHttpBinding" bindingConfiguration="" name="FetchData" contract="WCF.Services.FetchData" />
</service>
Run Code Online (Sandbox Code Playgroud)
FetchData类(示例代码):
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Web;
using System.Xml;
using Webservices.Services;
using Data = Webservices.Data;
using System.ServiceModel.Web;
using System.IO;
using System.Net;
using System.ServiceModel.Channels;
using System.Web.UI;
using System.Text;
namespace WCF.Services
{
[ServiceContract(Namespace = "urn:WCF.Services.FetchData")]
public class FetchData
{
Data.GetConnect mConnect = new Data.GetConnect();
private Message RetrievePublishedData(String pub, int number)
{
String strOutput = String.Empty;
if (!String.IsNullOrEmpty(pub))
{
Boolean …Run Code Online (Sandbox Code Playgroud)