Export Gridview to excel inside an update panel. Could this be because the command button is on one of the tabs in a tabcontainer which is placed inside an overall update panel? There is also a very informative post for exporting gridview data to excel within an update panel that covers different case senarios. You can check this. This tells the UpdatePanels located inside the GridView, not to refresh on every Async Postback and not to get refreshed by any event that occurs from within the contents of the UpdatePanel. In other words, never refresh this UpdatePanel. This is true as long as you don't care about updating anything inside the GridView row. I have an Updatepanel and Gridview inside it. Using GridView inside UpdatePanel. 'System.Web.UI.PostBackTrigger' does not have this property – Gilly Feb 13.
I was trying to update the content of a modal dialog, and this code works for me:
However, when I try to place the LinkButton inside a gridview, like so:
This does not work, I get an error saying: A control with ID 'updateSomething' could not be found for the trigger in UpdatePanel 'upNewUpdatePanel'.
How can I use the ImageButton inside the gridview?
aperezaperez4 Answers
Try and add the asp:AsyncPostBackTrigger
to the asp:GridView
's OnRowCommand
event and handle the link button click in that event
and in the cs create the event like this
5377037Add another Update Panel surrounding your link button just like below.
MnemoGridview Not Updating Inside Updatepanel Postbacktrigger Gridview Button
You could set the UpdatePanel's UpdateMode to Conditional
and update it manually from the UpdateButton_Click-Handler:
Gridview Not Updating Inside Updatepanel Postbacktrigger Vs Asyncpostbacktrigger
LinkButton's Click-Event handler:
Gridview Not Updating Inside Updatepanel Postbacktrigger
Tim SchmelterTim SchmelterNot the answer you're looking for? Browse other questions tagged asp.netgridviewupdatepanellinkbutton or ask your own question.
C# Updatepanel Update Control
Re: FileUpload Inside of Gridview Which Is Inside of UpdatePanel
Update Updatepanel From Javascript
Aug 21, 2009 02:58 AM|Vince Xu - MSFT|LINK
Hi,
The btnUpload is inside GridView, so please use dynamical code on server-side to find the control from GridView.
On server-side page load, you can use GridView1.Rows[i].Cells[X].FindControl('btnUpload') to get the instance of button in each row of gridView, and set them as PostBackTrigger.
Update Updatepanel From Code Behind
PostBackTrigger pt=new PostBackTrigger();
pt.ControlID=GridView1.Rows[i].Cells[X].FindControl('btnUpload').UniqueID;
UpdatePanel1.Triggers.Add(pt);
But in this way, we have to bind many controls as trigger. That'll be so ugly. I suggest you set OnRowCommand='GridView1_RowCommand' event of gridview. Meanwhile, please set the commandname to the button(CommandName='upload'). Then you just need set the GridView Command event as the trigger. In addition, you can do something in rowcommand event on server-side, and you'll know which fileupload control trigger the postback.
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
int liRow;
if (e.CommandName 'upload')
{
liRow = Convert.ToInt32(e.CommandArgument);
}
}