03 2010 档案
摘要:我们习惯性的做法是在GridView的TemplateField使用RadioButton server control;正如我们在GridView的TemplateField使用checkboxes来完成多选功能一样,我们可以通过遍历行来获取选定checkboxes的值,但RadioButtons的区别之处在于同一页面状态之间只能选取一个RadioButton。那么我们可能会想如何赋予每一个RadioButton不同的名称以取得各自的值,但不幸的是GridView在生成行的同时没有为每一个RadioButton赋予不同名称。该如何解决呢?我们可以利用HTML RadioButton来巧妙的解
阅读全文
摘要:<asp:GridView ID="GridView1" runat="server" OnDataBound="GridView1_DataBound" OnRowDataBound="GridView1_RowDataBound"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:RadioButton ID="RadioButton2" runat="s
阅读全文
摘要:例如: 1. A.aspx用了一个叫MasterPage.master的母板页。 MasterPage.master.cs里定义了一个 int 型的变量 flag = 1 如何在A.aspx.cs里读出flag变量的值呢? 在 Page_Load 事件中添加如下代码: ((MasterPage)Pa例如: 1. A.aspx用了一个叫MasterPage.master的母板页。 MasterPage.master.cs里定义了一个 int 型的变量 flag = 1 如何在A.aspx.cs里读出flag变量的值呢? 在 Page_Load 事件中添加如下代码: ((MasterPag...
阅读全文
摘要:母模版:C#代码:public partial class MasterPage : System.Web.UI.MasterPage{ public int UserId { get { return 342; } } public string UserName = "shenjk"; protected void Page_Load(object sender, EventArgs e) { }}在页面中获取该值:C#代码: protected void Page_Load(object sender, EventArgs e) { PropertyInfo ...
阅读全文
摘要:TextBox myemail = (TextBox)this.Page.Master.FindControl("show").FindControl("email");string email = myemail.Text;这2行代码让我找了2天,我一直认为是:TextBox myemail = (TextBox)this.Page.FindControl("email");string email = myemail.Text;总是一个错误:未将对象引用设置到对象的实例。
阅读全文
浙公网安备 33010602011771号