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!
精彩评论