开发者

div innerHTML problem with updatepanel

I have an application developed in asp.net which set innerhtml of div. I am creating an html string to show googlemap. It works fine. But when I put my div inside update panel. it doesnt show googlemap in div. Here is my aspx file code:

            </td>
        </tr>
        <tr>
            <td colspan="4">
                <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                    <ContentTemplate>
                        <div id="map_canvas" runat="server" style="width: 100%; height: 1500px; margin-bottom: 2px;
                            text-align: center;">
                            <asp:Panel ID="Panel1" runat="server">
                                <%--Place holder to fill with javascript by server side code--%>
                                <asp:Literal ID="js" runat="server"></asp:Literal>
  开发者_StackOverflow中文版                              <%--Place for google to show your MAP--%>
                                <div id="Div1" style="width: 100%; height: 728px; margin-bottom: 2px;">
                                </div>
                                <br />
                            </asp:Panel>
                        </div>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="btnShow" EventName="Click" />
                    </Triggers>
                </asp:UpdatePanel>
            </td>
        </tr>

here is my button click event.

protected void btnShow_Click(object sender, EventArgs e)
{
  // works fine without update panel.     
  map_canvas.InnerHtml = showMapWithPoints();
}


Hai Asif, May be you should take a look at this..... http://www.reimers.dk/blogs/jacob_reimers_weblog/archive/2008/11/23/an-example-using-updatepanels-and-google-maps.aspx


When you do:

map_canvas.InnerHtml = showMapWithPoints();

You are overwriting everything, including all your server side controls, within that div.

Are you doing anything that requires those controls to be available such as you 'js' and 'div1' controls?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜