开发者

Show DIv Element on click link button from another update panel using jquery

开发者 https://www.devze.com 2023-03-01 00:07 出处:网络
I want to show the<div>element which contains two update panels whenever I click on the link button with ID lnkOrderIDwhich is also in the other update panel. I am using jQuery:

I want to show the <div> element which contains two update panels whenever I click on the link button with ID lnkOrderID which is also in the other update panel. I am using jQuery:

<asp:UpdatePanel>
<asp:LinkButton ID="lnkOrderID" Text='<%# Bind("OrderID") %>' runat="server" CommandName="EditMarketOrder"开发者_C百科 OnClientClick="ShowHideDivs();"
</asp:UpdatePanel>


<div id="divOrderLines" runat="server">
    contain two update panel which i need to show when i click on link button
</div>


Ahh jQuery and webforms-- fun stuff!

Anyway, I think you might be better off doing all the binding and function calling straight from JavaScript instead of playing with the ClientClick property.

You said you are using jQuery... is it inline or in a separate js file?

If it's inline, you can do something like this:

$(document).ready(function() {
    $("#<%= lnkOrderID.ClientID %>").click(function() {
        $("#<%= divOrderLines.ClientID %>").show();
    });
});

If it's in an external file, you don't have access to the <% %> tags, so you can use jQuery's regex engine for finding selectors. The following searches for IDs starting with the string in quotes:

$(document).ready(function() {
    $("*[id$='lnkOrderID']").click(function() {
        $("*[id$='divOrderLines']").show();
    });
});

Good luck!

0

精彩评论

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