AJAX UpdatePanel & HtmlGenericControl ('div')

  • Thread starter Thread starter Horváth Szilárd
  • Start date Start date
H

Horváth Szilárd

Hello!

I'd like to know, how can i update an UpdatePanel content with an
HtmlGenericControl (div) on click event?

sample code:

<div id="Button01" runat="server");">Text</div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div class="Content" id="Content" >
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Panel ID="Panel1" runat="server">
</asp:Panel>
</ContentTemplate>
<Triggers>
/* if write to here a trigger with ControlID="Button01", it doesn't
work.
</Triggers>
</asp:UpdatePanel>

Thx
 
Hi,

This could be one way to do it:

1., define an update function
<script type="text/javascript">
function Update() {
__doPostBack('<%= UpdatePanel1.ClientID %>', "")
}
</script>

2., handle Your divs click event
<div id="Button01" runat="server" onclick='Update();'>
Text</div>

Hope You find this useful.
-Zsolt
 
Hi,

It's not too good for me. I'd like to manage the UpdatePanel content from
codebehind when i click on 'Button01' div.

thnx
 
the div does not have a server side onclick event, nor does the panel.
the easiest is to render a hidden button, and have javascript click it:

<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div id="div1"
onclick="$get('<%=button01.ClientID %>').click();">Text
<asp:button id="button01" runat="server" style="display:hidden" />
</div>

-- bruce (sqlwork.com)
 
Hi!

That's what I want! :)
Just replace 'hidden' to 'none' and work fine.

Thank You very much!!
 
Back
Top