摘要: 方法一:使用Ajax开发框架,后台方法定义前添加[AjaxPro.AjaxMethod],然后就可以在前台js脚本中调用后台C#函数。 方法二:后台方法声明为public或者protected,然后前台使用js脚本进行调用。以下是代码片段:.cs public string Str() { return "javaScript函数中执行后台C#方法.."; } .aspx <script type="text/javascript"> var a = "<%=Str()%>"; alert(a); </s 阅读全文
posted @ 2011-11-27 22:27 易尔购 阅读(473) 评论(0) 推荐(0) 编辑
摘要: 1.复制字符串Copy方法可以把一个字符串复制到另一个字符串中。语法:public static string Copy (string str)参数:str :要复制的字符。本例通过String类的Copy方法复制字符串“www.soAsp.net”。代码如下: protected void Button1_Click(object sender, EventArgs e) { string str = Label1.Text.ToString(); //Copy方法的使用 Label2.Text = string.Copy(str); }2.移除字符串若想把一个字符串开始或末尾位置的一组指 阅读全文
posted @ 2011-11-27 22:26 易尔购 阅读(5319) 评论(0) 推荐(0) 编辑
摘要: FindControl的使用方法 Control.FindControl (String):在当前的命名容器中搜索带指定 id参数的服务器控件。(有点类似javascript中的getElementById(string))简单的例子:<form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server">TextBox</asp:TextBox> <asp:Button 阅读全文
posted @ 2011-11-27 10:07 易尔购 阅读(15646) 评论(2) 推荐(4) 编辑