calling codebehind function from javascript(in design)

Posted by Oswaldlily under ASP.NET on 7/16/2013 | Points: 10 | Views : 1314 | Status : [Member] | Replies : 2
: is it possible to call function in codebehind from javascript(whch in design page)??




Responses

Posted by: Kamlesh420 on: 7/16/2013 [Member] Starter | Points: 25

Up
0
Down
yes you can do .

here i click one asp.net button Button1 on the selected index change of dropdown .

 function myFunction(dropdownlist, roomno) {

document.getElementById("<%= HiddenField1.ClientID %>").value = dropdownlist.value + "|" + roomno;
__doPostBack('Button1', '')
}



<asp:DropDownList ID="DropDownList1" runat="server" Width="150" onchange='<%# "myFunction(this," + Container.ItemIndex + ")" %>'>

</asp:DropDownList>



protected void Button1_Click(object sender, EventArgs e)
{
//call your function here
}



kamlesh kuamr saini
Sr. devloper (asp.net)
new delhi

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rimi1289 on: 7/16/2013 [Member] Starter | Points: 25

Up
0
Down
Read this article. It you help you.

http://www.encodedna.com/2012/11/call-javascript-codebehind.htm

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response