What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 48605 |  Welcome, Guest!   Register  Login
 Home > Forums > ASP.NET 4.0 > to raise server side event from the client side javascript. ...
Jaypalsinh

to raise server side event from the client side javascript.

Replies: 3 | Posted by: Jaypalsinh on 8/2/2011 | Category: ASP.NET 4.0 Forums | Views: 3459 | Status: [Member] | Points: 10  


hi,

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


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Kshah
Kshah  
Posted on: 8/2/2011 6:32:43 AM
Level: Starter | Status: [Member] | Points: 25

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. | Reply | Alert Moderator 

Jaypalsinh
Jaypalsinh  
Posted on: 8/2/2011 6:57:27 AM
Level: Starter | Status: [Member] | Points: 25

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. | Reply | Alert Moderator 

Kshah
Kshah  
Posted on: 8/2/2011 8:22:50 AM
Level: Starter | Status: [Member] | Points: 50

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. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/22/2013 7:05:24 AM