Call another event by Javascript


Some time we need to do something when mouse move on any information related title or link. That time we will need to call another event to fill this need by javascript.

In dot net environment, there is a grid or gridview which is showing multiple sales information as user wise. If admin want to know about particular user information then we can use javascript onmouserover method to show this information and this javascript event call another code behind event to show this information without clicking on that link with passing userid also.

Html page description
--- link button


<asp:LinkButton ID="LinkButton1" runat="server" BorderStyle="None" OnClick="LinkButton1_Click" onmouseover="clickLink(this, '2');" Font-Underline="False">LinkButton</asp:LinkButton>

to hold the userid in the hidden field----

<asp:HiddenField ID="hfId" runat="server"/>

<script language="javascript">
function clickLink(evt, val)
{
document.getElementById('hfId').value =val;
evt.click();
}
</script>


code behind page description-----

protected void LinkButton1_Click(object sender, EventArgs e)
{
strReportHeader = hfId.Value;
Response.Write(strReportHeader);
}


In the above example- you can call page behind method with the help of javascript.


Comments

Author: Prakash kumar pothal18 Feb 2010 Member Level: Gold   Points : 2

using javascript u called this function
function NewEventClick()
{
document.getElementById('<%=btnSend.ClientID%>').click();
}

Html part
--------------



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: