to raise server side event from the client side javascript. [Resolved]

Posted by Jaypalsinh under Regular Expressions on 8/2/2011 | Points: 10 | Views : 6808 | Status : [Member] | Replies : 3
hi,

I want to raise server side event from the client side...
have you any idea.. plz help me...




Responses

Posted by: Kshah on: 8/2/2011 [Member] Starter | Points: 50

Up
0
Down

Resolved
<asp:Button ID="btnCreate" runat="server" CssClass="hiddencol" OnClick="btnCreate_Click"
Text="Create" UseSubmitBehavior="False" />

//client side script
function RefreshData() {
__doPostBack('btnCreate', '');
}

//Server-side event
protected void btnCreate_Click(object sender, EventArgs e)
{
try
{
//your code
}
catch (Exception)
{
throw;
}
}



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

Posted by: Kshah on: 8/2/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Jaypalsinh,
You can use function __doPostBack(eventTarget, eventArgument) eventTarget is the control on which you wanted to call the event and event argument is just an additional data associated with the control and If your using AJAX then you can use PageMethods.(your server side method name) to call server-side event.

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

Posted by: Jaypalsinh on: 8/2/2011 [Member] Starter | Points: 25

Up
0
Down
Thanks kshah,

Can you show me one example of this?
and i am not using AJAX.

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

Login to post response