ashok kumar

ashok kumar

  • NA
  • 89
  • 36.1k

editing an row in an grid view using the radio button,

Jul 16 2013 11:53 AM
<div id="loginblock">
    <table>
        <tr>
  <td>UserName:</td>

            <td>
<asp:TextBox ID="username" runat="server" onBlur="txtvalidation();" AutoPostBack="true"></asp:TextBox>
      </td>
            <td>
                <div id="warning" style="color:aqua;width:100px" runat="server">

                </div>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="PlS Enter Password" ControlToValidate="pwd"></asp:RequiredFieldValidator>

            </td>
            </tr>
        <tr>
            <td>Password:</td>
            <td>
 <asp:TextBox ID="pwd" runat="server" TextMode="Password" ></asp:TextBox>
                </td>
            </tr>
        <tr>
            <td>
                <asp:Button ID="btnLogin" runat="server" OnClick="btnLogin_Click" Text="Button" />
    </td>
            </tr>
        <tr>
            <asp:GridView ID="grd" runat="server" OnRowEditing="selectrd_CheckedChanged"  AutoGenerateColumns="false" DataKeyNames="userid">
          <Columns>
              <asp:TemplateField HeaderText="edition">
             <ItemTemplate>
             <asp:RadioButton ID="rdnselect" runat="server"   CommndName="edit" />

             </ItemTemplate>
              </asp:TemplateField>
           <asp:BoundField HeaderText="ids" DataField="userid" />
              <asp:TemplateField HeaderText="password">
                  <ItemTemplate>
                      <%# Eval("pwd") %>
                  </ItemTemplate>
                  <EditItemTemplate>
                      <asp:TextBox ID="edits" runat="server"   Text='<%# Eval("pwd") %>'></asp:TextBox>
                  </EditItemTemplate>
              </asp:TemplateField>
          </Columns>
            </asp:GridView>

cs:

protected void selectrd_CheckedChanged(object sender, GridViewEditEventArgs e)
{

    grd.SelectedIndex = e.NewEditIndex;
    ldgrid();

}
here if we remove the radiobutton and insert link button,onclick of the link button we can edit the values,pls say me how to do the same operation with the radio button.




Answers (2)