AJAX UpdatePanel & HtmlGenericControl ('div')

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
 
M

miher

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
 
H

Horváth Szilárd

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
 
B

bruce barker

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)
 
H

Horváth Szilárd

Hi!

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

Thank You very much!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top