Silverlight应用程序中获取ASP.NET页面参数
方法一:使用InitParameters
传递参数页面:
传递一个参数
string url = "index.aspx?UserID=" +userId;
//最大化
string refUrl = "<Script>window.self.open('" + url + "', '', 'fullscreen=yes,scrollbar=no,toolbar=no,location=no,status=no, menubar=no, resizable=no', true);</script>";
this.Response.Write(refUrl);
Silverlight Host 页面:
string UserID= Request.QueryString["UserID"].ToString();
//将参数传到Silverlight 里
this.Xaml1.InitParameters = String.Format("UserID={0}",UserID);
silverlight App.xaml.cs里
private void Application_Startup(object sender, StartupEventArgs e)
{
// 获得参数
string userId = e.InitParams["UserID"].ToString();
this.RootVisual = new index();
}
方法二 :使用System.Windows.Browser.HtmlPage.Document.QueryString
传递参数页面:
传递一个参数
string url = "index.aspx?UserID=" +userId;
//最大化
string refUrl = "<Script>window.self.open('" + url + "', '', 'fullscreen=yes,scrollbar=no,toolbar=no,location=no,status=no, menubar=no, resizable=no', true);</script>";
this.Response.Write(refUrl);
Silverlight Host 页面:
无
silverlight 程序里
IDictionary<string, string> paras = System.Windows.Browser.HtmlPage.Document.QueryString;
string UserID = paras["UserID"];
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/YanRocky/archive/2009/06/11/4
相关文档:
最近做网站用到了上传控件,找到了一个界面比较好看的 Uploadify
看到别人的文章学会使用 。原文地址:
http://doc.chinaunix.net/web/201001/304549.shtml
不是转帖,自己写写自己的。一个完整的解决方案。包括文件上传,文件信息获取和显示,语言:C#
Upload.aspx //上传主页--主要是配置 jquery. ......
/// <summary>
/// HTML解码
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public string HtmlDecode(string input)
&nb ......
1.
ClientScript.RegisterStartupScript(this.GetType(), "js1", "alert('删除成功');window.location='QuerySortList.aspx';", true);
2.
this.cmdSave.Attributes.Add("onclick", "return f_StringCheck()"); ......
给页面的TextBox设置ReadOnly="True"时,在后台代码中不能赋值取值,下边几种方法可以避免:
1、不设置ReadOnly,设置onfocus=this.blur()
C#代码
<asp:TextBox ID="TextBox1" runat="server" onfocus=this.blur()></asp:TextBox>
<asp:TextBox ID="TextBox1" runat="serve ......
ASP.NET正则表达式集合
1.帐号由a~z的英文字母(不区分大小写)、0~9的数字、点、减号或下划线组成,长度为
3~18个字符,例如:kyzy_001
^[a-zA-Z0-9.-_]{3,18}$
2.输入框里必须为数字
^[0-9]{1,}$
3.电子邮件格式
\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
4.要求文本框只能输入最多 ......