Devendra  Kumar

Devendra Kumar

  • NA
  • 517
  • 243.7k

inside grid view check box checked row get id of row c#

May 18 2016 1:21 AM
hi frnds i have a grid view inside get value from database 
in add check box inside grid view
i want when check box checked open popup and add some field
 
i add this process but i can't get right row id please help me i use this program
 
 
<asp:TemplateField HeaderText="Client Name" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="10%"
Visible="false">
<ItemTemplate>
<asp:Label ID="lbl_wokid" runat="server" Text='<%#Eval("Work_Id") %>' Visible="false"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Client Name" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="10%">
<ItemTemplate>
<asp:Label ID="lbl_clname" runat="server" Text='<%#Eval("Company_name") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
  
<asp:TemplateField HeaderText="Work Process" ItemStyle-Horizontal HeaderStyle-Width="10%">
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" OnCheckedChanged="CheckedChanged" AutoPostBack="true" Text="Done" />
</ItemTemplate>
<EditItemTemplate>
</EditItemTemplate>
<ItemStyle VerticalAlign="Middle" />
</asp:TemplateField>
 
 
 
 
 
on check chenged
 
 
protected void CheckedChanged(object sender, EventArgs e)
{
if (sender != null)
{
if (((CheckBox)sender).Checked)
{
txtCompany.Text = string.Empty;
txt_fee.Text = string.Empty;
popup.Show();
}
else
{
popup.Hide();
}
}
}
 
 
save button:
 
 
protected void btn_save(object sender, EventArgs e)
{
Label lbl_pro_id = (Label)grid_data.Rows[0].FindControl("lbl_wokid");
objadmin.Work_Id = int.Parse(lbl_pro_id.Text);
objadmin.ClientId = 0;
objadmin.EpId = 0;
objadmin.Feedback = txtCompany.Text;
if (txt_fee.Text == "")
{
objadmin.Fee = 0;
}
else
{
objadmin.Fee = Convert.ToDecimal(txt_fee.Text);
}
objadmin.end_date = System.DateTime.Now;
DataSet ds = objadmin.binddprt1("updatedescription");
bind();
ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alert('Feedback Save successfully !!');", true);
}
 

Answers (1)