Monday, March 26, 2012

Updating from a template control

Hello,

I'm having an issue getting a Label inside of an UpdatePanel to change when a button in a GridView PagerTemplate is clicked. I have a label that I am showing the Page X of Y count. I have defined the First, Next, Previous and Last commands as Buttons in the PagerTemplate. The problem is that when I click the button, in the code behind I am setting the Text of the label, but it is not changing on the page. I cannot register the button in the UpdatePanel Triggers, because it is in the PagerTemplate. How can I make the label update from the button?

Thanks,

Nick

If I set up a Trigger on the gridview's databound event, will this cause the label to update?

Thanks,

Nick


You don't need to go that way.

Just do ScriptManager.GetCurrent( this.Page ).RegisterAsyncPostBackControl( control );

You have to do this on each post though. (ItemCreated will get fired each post)


Would this be done in the Pages Load event, or the button's click event?

Thanks,

Nick


Subscribe to the ItemCreated event in your grid and do it on all the rows. (e.Item).

No comments:

Post a Comment