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
相关文档:
asp.net系统,在登录或注册时常提供数字或字符混合的验证码,这里介绍如何操作。
1,Default 页面
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
& ......
Asp.Net清空页面所有textbox的几种方法总结
在Asp.Net中清空所有textbox有好几种方法,本文提供几种,供大家参考!
foreach( Control childControl in this.Controls )
{
if( childControl is TextBox )
((TextBox)childControl).Text = "";
}&n ......
ASP.NET Cookie 概述
Cookie 提供了一种在 Web 应用程序中存储用户特定信息的方法。例如,当用户访问您的站点时,您可以使用 Cookie 存储用户首选项或其他信息。当该用户再次访问您的网站时,应用程序便可以检索以前存储的信息。
什么是 Cookie?
Cookie 是一小段文本信息,伴随着用户请求和页面在 Web 服务器和浏览器之 ......
我们在ASP.NET程序的开发过程中,常常需要向用户给出提示信息,比如是否“操作成功”,“确定”还是“取消”操作。
(1) 点击页面上的按钮,弹出一个对话框提示是“确定”还是“取消”操作,我们采用在按钮中添加属性来完成:
......
这里我只摘取了原文的Code以供潜心研究.using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Configuration;
using System.Data.SqlClient;
using System.Web.Security;
using System.Data;
public ......