tags:

views:

20

answers:

2

Hi This is kind of peculiar requirement..

I am using asp.net and jQuery together

I have a link button as follows

<asp:LinkButton ID="displayBtn" runat="server" OnClick="displayBtn_Click" Text="Display 
Content"></asp:LinkButton>

I will hide this link button using

style="dipsly:none;" 

and want to call the postback called by click of the asp link button using some other html element say a div.

<div id="invokeTest"> Click here </div>

I tried using

$('#invokeTest').click(function(){
  $('#<%=displayBtn.ClientID%>').click();
});

Any idea how could this be done?

+1  A: 

Try

$('#<%=displayBtn.ClientID%>').trigger("click");

See .trigger()

rahul
I had tried it but did not work.. :( i use jQuery 1.4.2
Amit
+1  A: 

Instead of a LinkButton try using a Button:

<asp:Button ID="displayBtn" 
            runat="server" 
            OnClick="displayBtn_Click" 
            Text="Display Content" 
/>
Darin Dimitrov
hey it worked.. :) thanks man...!
Amit
i changed from link button to <asp:Button and called it with .trigger() like this$('#<%=displayBtn.ClientID%>').trigger("click");
Amit