首页 \ 问答 \ 在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.

相关问答

更多
  • 通过安装柏林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: ...
  • 尝试自定义您的区域设置 。 使用德国和德国。 德国被用于德国的国家而不是语言 。 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 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)