Click here to Skip to main content
15,902,275 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hello guyzz..

here i have a page with gridview.in TemplateField i have a check box and a button(Edit)...i checked checkbox and saved in database sucessfully.
Now if i want to edit that gridview..here how can i checked checkbox in gridview..with database Value(eg: row_ID)..



Thanks in Advance...

--Ranjith
Posted
Comments
[no name] 21-Dec-15 12:47pm    
your question is not clear can you improve your question here
Ranjith Vu 21-Dec-15 13:29pm    
hello vinod..
in my application i have one clint registration form(say it is registration.aspx),in this page i have some textboxes, dropdown controles for inserting clint data...in this page i have one gridview with checkbox's..in this gridview i am displaying some data say it is like a location information..i have 2 locations in gridview(loc1,loc2) .now the client selecting loc2 by checking checkbox..and save the data in database..
Now the client wants to edit his information..here i am retriving data from database and placed his data in registration.aspx ...here i am easily palce data into textboxs and dropdown's but i am unable checked checkbox in gridview for loc2 value..so how can i checked checkbox here with database value...???
[no name] 21-Dec-15 13:42pm    
So when you want to bound data back for GridView control from DB for editing use RowDataBound event to bind data for checkbox -

protected void gri2_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
CheckBox chk = e.Row.FindControl("chk1") as CheckBox;
//chk.Checked = Get value from your DS and set here
}
}
[no name] 21-Dec-15 13:44pm    
if this is not what you are looking for, better add your code which is not working for you...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900