首页
\
问答
\
在ASP.NET中的GridView中使用RadioButton的问题(Problem with usage of RadioButton in GridView in ASP.NET)
在ASP.NET中的GridView中使用RadioButton的问题(Problem with usage of RadioButton in GridView in ASP.NET)
<asp:TemplateField HeaderText="Select One"> <ItemTemplate> <input name="MyRadioButton" type="radio" /> </ItemTemplate> </asp:TemplateField>
aspx.cs
protected void Button1_Click(object sender, EventArgs e) { foreach (GridViewRow di in GridView1.Rows) { RadioButton rad = (RadioButton)di.FindControl("MyRadioButton"); //Giving Error:Object reference not set to an instance of an object. if (rad.Checked&&rad!=null) { s = di.Cells[1].Text; } } Response.Redirect("applicants.aspx?form=" +s); }
我无法获得在
RadioButton
选择的行。 你能帮我解决这个问题吗?<asp:TemplateField HeaderText="Select One"> <ItemTemplate> <input name="MyRadioButton" type="radio" /> </ItemTemplate> </asp:TemplateField>
aspx.cs
protected void Button1_Click(object sender, EventArgs e) { foreach (GridViewRow di in GridView1.Rows) { RadioButton rad = (RadioButton)di.FindControl("MyRadioButton"); //Giving Error:Object reference not set to an instance of an object. if (rad.Checked&&rad!=null) { s = di.Cells[1].Text; } } Response.Redirect("applicants.aspx?form=" +s); }
I couldn't get the row which is selected in
RadioButton
. Can you help me with this please.
原文:https://stackoverflow.com/questions/6490996
更新时间:2022-04-12 12:04
最满意答案
通过安装柏林10.1,并从头开始设置环境(安装软件包,更新库路径等)来修复它。我不知道这是通过使用新版本的Delphi修复的,安装我的软件包。
Fixed it by installing Berlin 10.1 and just setting up the environment from scratch (installing packages, updating library paths etc...) I don't know if this was fixed by using the newer version of Delphi, or if it was me re-installing my packages.
相关问答
更多-
访问casted对象的属性返回Android上的意外结果(Accessing property of casted object returning unexpected results on Android)[2023-05-08]
通过安装柏林10.1,并从头开始设置环境(安装软件包,更新库路径等)来修复它。我不知道这是通过使用新版本的Delphi修复的,安装我的软件包。 Fixed it by installing Berlin 10.1 and just setting up the environment from scratch (installing packages, updating library paths etc...) I don't know if this was fixed by using the new ... -
您可能会被方法名称误导。 capitilizedLetterCharacterSet返回“标题”字母。 uppercaseLetterCharacterSet可能就是你要找的东西。 You might be mislead by the method name. capitilizedLetterCharacterSet returns "titlecase" letters. uppercaseLetterCharacterSet ist probably what you are looking for ...
-
它的Y2K! 年度增加1900。 月份为0索引。 Its Y2K! Add 1900 to the year. The months are 0 indexed.
-
您无法通过PHPDoc提示自定义数组键(无论是键名本身还是值类型) - 目前它不受支持。 https://youtrack.jetbrains.com/issue/WI-3423 https://youtrack.jetbrains.com/issue/WI-5304 观看这些门票(星级/投票/评论)以及可能的一些相关门票以获得进展通知。 You cannot hint custom array keys via PHPDoc (be it key name itself or value type) -- ...
-
您正在执行的查询意味着AND。 这意味着它将排除sales_date小于date并且id等于instance.id。 如果我理解正确,你可以这样做: qs = self.model.objects.exclude(invoice__sale_date__lt=date).exclude(id=instance.id) The query you are executing means AND. That means that it will exclude sales_date less than dat ...
-
这是“上下文”的问题,前两个例子不是对象文字! 它们是声明块,例如: { foo: 'bar' } 上面的代码被评估为一个块,包含一个指向表达式语句 (字符串文本'bar' )的带标签的语句 ( foo )。 将它包装在括号中时,代码将在表达式上下文中进行评估,因此语法与Object Literal语法相匹配。 实际上,还有其他方法可以强制执行表达式评估,并且您会看到dot属性accesor表示法在直接应用于对象文字时有效,例如: ({foo:'bar'}.foo); // 'bar' 0, {foo: ...
-
Android GeoCoder:按邮政编码搜索会返回意外结果(Android GeoCoder: search by zip code returns unexpected results)[2023-03-29]
尝试自定义您的区域设置 。 使用德国和德国。 德国被用于德国的国家而不是语言 。 Locale locale = new Locale(langCode, countryCode) Locale locale = new Locale("de", "DE"); Geocoder iGeocoder = new Geocoder(getContext(), locale); GeoCode默认为美国,因此它首先会过滤搜索邮政编码。 如果你在这里测试 : 97070给出了Wilsonville,OR 9 ... -
好吧,我不是父亲,但这对你的代码有什么影响,但是fetchmany会把整个结果集带到内存然后拿出指定的子集。 使用joinqueryover或joinalias来实现相同的.. var c = session.Query
().Take(5).FetchMany(x => x.Table2).ToList(); 这变成了 Table2 table2Alias=null; var c = session.QueryOver ().JoinAlias(x => x.Table2,( ... -
所有引用都需要保存与引用或其子类型相同类型的对象。 由于编译器只知道getGroup返回Object ,因此不能将Object分配给TestClass引用(Object可能没有实现TestClass所有的所有方法)。 要解决这个问题,您需要明确告诉编译器getGroup返回的对象也是TestClass类,通过强制转换它。 All references needs to hold objects of same type as reference or its subtypes. Since compiler ...
-
strcmp和类似的比较函数将字符串中的字节视为unsigned char s,如第7.24.4节第1点中的标准所规定(C99中为7.21.4) 比较函数memcmp,strcmp和strncmp返回的非零值的符号由所比较的对象中不同的第一对字符(均被解释为unsigned char)的值之间的差异的符号确定。 (强调我的)。 原因可能是这样的解释维持了常见编码中代码点之间的顺序,而将它们解释为签名char则不然。 The strcmp and similar comparison functions tr ...