views:

467

answers:

2

as my title says...

How do you make a LinkButton fire a POSTBACK (not ASYNCPOSTBACK) which is inside a GridView and is under an UpdatePanel?

My Scenario is this,

I have a grid. say table A, which populates a Linkbuttons with link to do Server.Transfer calls from Page1 to Page2.

I have a good reason why i am using a Server.Transfer because of previous page referencing methods and Response.Redirect doesnt fit at all.

normally it would work if i add the grid as a Postback trigger in the UpdatePanel like so

<Triggers><asp:PostBackTrigger ControlID="gvitem" /></Triggers>

but since I have another control inside the grid that needs to be do an AsyncPostback, that would not work also,

all that's lacking is have this line of code, do postback.

<asp:TemplateField HeaderText="Description" SortExpression="ShortDesc">
     <ItemTemplate>
           <asp:LinkButton ID="btndesc" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ShortDesc")%>' CommandName="Edit" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "Key") %>' />
     </ItemTemplate>
</asp:TemplateField>

anyone have an idea?

+2  A: 

Find btndesc on grid.ItemDataBound and register it as a PostBackTrigger.

rick schott
A: 

Hi !!

I'm New in ASP and I have the same problem, Could you explain how register the control in the event.

Thanks

Luis