本文介绍了如何在GridView中使用jQuery都被选择(单选按钮)的行值(标签)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是一个code我试图做的,但它不能正常工作

  $(#a_btn)。点击(函数()
{
    如果(('表[ID * =GridView_Customer]输入[类型=电台]:勾选'))
        {
           VAR lblStatus = $('表[ID * =GridView_Customer] [ID * =lblStatus])文本()。
           警报(lblStatus);
        }
 }

当我选择RadioButton_Select,点击a_btn需要获得

lblStatus值

在此先感谢

修改1 包括HTML:

 <一个ID =a_btn>取消< / A>
     //锚标签
 < ASP:GridView控件ID =GridView_Customer的AutoGenerateColumns =假=服务器>
       <柱体和GT;
            < ASP:的TemplateField>
                <&ItemTemplate中GT;
                   < ASP:单选=服务器ID =RadioButton_Select的AutoPostBack =真> < / ASP:单选>
                 < / ItemTemplate中>
            < / ASP:的TemplateField>
           < ASP:的TemplateField>
               <&ItemTemplate中GT;
                   < ASP:标签ID =lblStatus文本='<%#的eval(状态)%GT;' WIDTH =80px=服务器> < / ASP:标签>
               < / ItemTemplate中>
            < / ASP:的TemplateField>
       < / Coloumns>
< / ASP:GridView的>


解决方案

 < ASP:GridView控件ID =GridView_Customer的AutoGenerateColumns =假=服务器OnRowCommand =gdBankDetils_RowCommand >
           <柱体和GT;
                < ASP:的TemplateField>
                    <&ItemTemplate中GT;
                       < ASP:单选=服务器ID =RadioButton_Select的AutoPostBack =真> < / ASP:单选>
                       < ASP:HiddenField ID =hdnId值='<%#的eval(ID)%GT;' =服务器/>
                     < / ItemTemplate中>
                < / ASP:的TemplateField>
               < ASP:的TemplateField>
                   <&ItemTemplate中GT;
                       < ASP:标签ID =lblStatus文本='<%#的eval(状态)%GT;' WIDTH =80px=服务器> < / ASP:标签>
                   < / ItemTemplate中>
                < / ASP:的TemplateField>
           < / Coloumns>
    < / ASP:GridView的>

code bihind

 保护无效GridView_Customer_RowCommand(对象发件人,GridViewCommandEventArgs E)
        {
         //执行操作
        }

Here is a code i am trying to do but it is not working properly

$("#a_btn").click(function ()
{
    if(('table[id*="GridView_Customer"] input[type="radio"]:checked'))
        {
           var lblStatus = $('table[id*="GridView_Customer"] [id*="lblStatus"]').text();
           alert(lblStatus);
        }
 }

when i select "RadioButton_Select" and click on a_btn need to get "lblStatus" value

Thanks in advance

Edit 1 Including html:

    <a id="a_btn">cancel</a>
     //Anchor tag
 <asp:gridview id="GridView_Customer" autogeneratecolumns="false" runat="server" >
       <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                   <asp:RadioButton runat="server" id="RadioButton_Select" AutoPostBack="True"> </asp:RadioButton>
                 </ItemTemplate>
            </asp:TemplateField>
           <asp:TemplateField >
               <ItemTemplate>
                   <asp:Label ID="lblStatus" Text='<%# Eval("Status") %>' width="80px" runat="server"> </asp:Label>
               </ItemTemplate>
            </asp:TemplateField>
       </Coloumns>
</asp:Gridview>
解决方案
        <asp:gridview id="GridView_Customer" autogeneratecolumns="false" runat="server"  OnRowCommand="gdBankDetils_RowCommand" >
           <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                       <asp:RadioButton runat="server" id="RadioButton_Select" AutoPostBack="True"> </asp:RadioButton>
                       <asp:HiddenField ID="hdnId" Value='<%#Eval("Id") %>' runat="server"/>
                     </ItemTemplate>
                </asp:TemplateField>
               <asp:TemplateField >
                   <ItemTemplate>
                       <asp:Label ID="lblStatus" Text='<%# Eval("Status") %>' width="80px" runat="server"> </asp:Label>
                   </ItemTemplate>
                </asp:TemplateField>
           </Coloumns>
    </asp:Gridview>

Code bihind

protected void GridView_Customer_RowCommand(object sender, GridViewCommandEventArgs e)
        {
         //Perform Action
        }

这篇关于如何在GridView中使用jQuery都被选择(单选按钮)的行值(标签)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 13:26