Please show your sample code. It will be difficult to figure out what's happening in there. Meanwhile you can check this link for getting new data from database.
Do you do your databinding in your page load event handler? If so you might wanna make sure you only do the databinding when the page is not in a postback state. So e.g.:
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!Page.IsPostBack)
{
//Do your databinding
}
}
Matthijs Koopman
Please mark my reply as answer if you found it help full
Nancy2012
0 Points
1 Post
How to retrieve data changes by check box selection in gridview
Dec 23, 2012 10:06 AM|LINK
helo frnds,
im trying to capture updated data from gridview upon check box selection..
however im unable to retreive new data..
it alwasy capture old data...pls help me...
i haave used gridediteventargs..but in vain......
i want to capture new data in button click event
best rgrds
nancy
oned_gk
All-Star
30991 Points
6344 Posts
Re: How to retrieve data changes by check box selection in gridview
Dec 23, 2012 11:02 AM|LINK
arun banik
Member
88 Points
20 Posts
Re: How to retrieve data changes by check box selection in gridview
Dec 23, 2012 02:03 PM|LINK
Please show your sample code. It will be difficult to figure out what's happening in there. Meanwhile you can check this link for getting new data from database.
Ref: http://www.encodedna.com/2012/12/open-new-window-gridview.htm
Rajat
Member
444 Points
131 Posts
Re: How to retrieve data changes by check box selection in gridview
Dec 23, 2012 04:11 PM|LINK
Hi Nancy,
as per my understanding you need to access the gird template control's value on checkbox change event which exist in grid it self
So here is the solution
1) allow checkbox to Autopostback event true in html code like below syntax also define a checked changed event "Oncheckedchanged" event
<asp:CheckBox ID="chkNotify" runat="server" AutoPostBack="true" OnCheckedChanged="chkNotify_CheckedChanged"
Checked='<%# Eval("Notify")%>' ToolTip="Click to change Notification email settings!" />
2) on code behind write following code
protected void chkNotify_CheckedChanged(object sender, EventArgs e)
{ try
{
GridViewRow gvRow = ((CheckBox)sender).NamingContainer as GridViewRow; CheckBox chkbx = sender as CheckBox; //Now find other controls in gvrow object
}
}
I hope this will help you.
m.koopman
Participant
1372 Points
294 Posts
Re: How to retrieve data changes by check box selection in gridview
Dec 23, 2012 05:38 PM|LINK
Do you do your databinding in your page load event handler? If so you might wanna make sure you only do the databinding when the page is not in a postback state. So e.g.:
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!Page.IsPostBack) { //Do your databinding } }Please mark my reply as answer if you found it help full