Sunday, 10 February 2013
Monday, 4 February 2013
Selection In GridView With CheckBoxes
CheckBoxes Wise Selection In GridView in just 3 steps
1)In ASPX side
your grid view must contain DataKeyNames
and checkbox under templatefield
<asp:GridView ID="GridViewtemp" runat="server" DataKeyNames="Person_Id">
2)Now you have above grid where so many rows are avail and each row has a checkbox in it(as we placed a checkbox in templatefield's item template)
now when user click on these checkboxes and make out his selection we will provide him further a button 'btnselect' which will again bind a grid and show you only those selected row which were checked previously.
3)So On that btnselect_click event
In C# On Button Click
protected void btnselect_Click(object sender, EventArgs e)
{
for (int i = 0; i < GridViewtemp.Rows.Count; i++)
{
if (((CheckBox)GridViewtemp.Rows[i].FindControl("chkSONo")).Checked == true)
{
soid = ((Label)GridViewtemp.Rows[i].FindControl("lblPersonid")).Text;
if (value == "")
{
value = soid;
}
else
{
value = value + "," + soid;
}
}
}
BindItemGrid(soid);
}
public void BindItemGrid(string Key)
{
query = " select * from tb_Stamping where [Person_Id] in (" + value + ")";
SqlDataAdapter adp = new SqlDataAdapter(query, con);
DataSet ds = new DataSet();
adp.Fill(ds);
gvselectcontent.DataSource = ds;
gvselectcontent.DataBind();
}
Subscribe to:
Posts (Atom)
Print Only Grid View in ASP.net
ASP.net How to Print Only GridView < div id ="gridviewDiv" > < asp:GridView ID ="gridViewToPri...
-
AJAX: Simple CSS For AutoComplete Extender I know your AutoComplete Extender is working fine,but the thing is you are not happy with...
-
7 Easy Steps to get start with Crystal Report. To Start With You Shold Have A Table In your Database. Before I start I woul...
-
Basic Tutorial Of Web Service The Two Main Thing About Web Services Are Creating & Consuming! Below Example Will Let you Know H...