Showing posts with label controlid. Show all posts
Showing posts with label controlid. Show all posts

Monday, March 26, 2012

Trigger control outside the updatepanel

Hello,

I need that the control typed in the "ControlID" property of a trigger, to be outside of the updatepanel.

If I put the button inside of the updatepanel, atlas works correctly.

But if I put the button outside of the updatepanel, the button_Click event is doing a complete postback of the entire page.

I want to put the button outside, because i don't want to load the same button one more time, just want to refresh the updatepanel when this button is clicked.

I hope you can understand. You can note my english is not very well.

Thanks!

You can make the button_Click handler call the UpdatePanelName.Update() function to make a partial postback on updatepanel UpdatePanelName. I hope this helps!
I had a similar requirement and used updatepanels inside a main updatepanel.

Thanks for your answers.

I've tried the UpdatePanel.Update() method, but still refreshing the entire page.

I've tried too somethinglike this:

<cc1:UpdatePanel ID="PanelFotoGrande" runat="server" Mode="Conditional"><ContentTemplate> ...Big Foto...</ContentTemplate><Triggers> <cc1:ControlEventTrigger ControlID="rptMiniaturas" EventName="ItemCommand" /></Triggers></cc1:UpdatePanel><cc1:UpdatePanel ID="PanelMiniaturas" runat="server" Mode="Conditional"><ContentTemplate> ...Thumbnails...</ContentTemplate></cc1:UpdatePanel>

With the same result. Finally, i've tried to group the two update panels inside other one. But still updating both updatepanels.

Maybe i have to disable the autopostbak fired by the button?? I don't know how..

Thanks a lot.

Saturday, March 24, 2012

Triggers for UpdatePanel

I am just learning how to use the UpdatePanel control, so please be patient with me.

I think I understand the concept of wiring ControlID/EventName combinations to the UpdatePanel's collection of triggers.

It seems fairly straight forward if you are wiring up a standard Button control, but in my case, I would like to wire a button control embedded in a user control or DataGrid control. I attempted to expose the button as a public property of the user control and tried to wire it up ("UserControl.MyButton" and "Click"), but I get the

"A control with ID 'WebUserControl1.MyButton' could not be found for the trigger in UpdatePanel 'UpdatePanel1'. "

error message.

I also would like to do the same with a button embedded in a datagrid, but that seems to be a tall order.

Thanks much in advance.

It seems strange at first but you can add the usercontol/datagrid (the button's parent control) as a trigger for the updatepanel. Maybe that is enough for you.

(You can also force the updatepanel to refresh in the server side: you handle your button click event server side and then simple call the update method of any updatepanel to your taste)


stmarti:

It seems strange at first but you can add the usercontol/datagrid (the button's parent control) as a trigger for the updatepanel. Maybe that is enough for you.

(You can also force the updatepanel to refresh in the server side: you handle your button click event server side and then simple call the update method of any updatepanel to your taste)

Could you give me an example of what the code ought to look like? I am not following you. Thank you.


hello.

well, just pass the id of the grid instead of passing the id of the button you've defined on the template.


Thanks. Works.