Click here to Skip to main content
15,888,968 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionUpdate Multiple Selected Item from Checkboxlist to SQL server database Pin
AsianRogueOne21-Jun-10 10:09
AsianRogueOne21-Jun-10 10:09 
AnswerRe: Update Multiple Selected Item from Checkboxlist to SQL server database Pin
Not Active21-Jun-10 11:10
mentorNot Active21-Jun-10 11:10 
AnswerRe: Update Multiple Selected Item from Checkboxlist to SQL server database Pin
Sandeep Mewara22-Jun-10 5:17
mveSandeep Mewara22-Jun-10 5:17 
QuestionPlz help making in custom shape of content place holder... Pin
Waqas0721-Jun-10 8:56
Waqas0721-Jun-10 8:56 
AnswerRe: Plz help making in custom shape of content place holder... Pin
Adam R Harris21-Jun-10 9:02
Adam R Harris21-Jun-10 9:02 
QuestionNeed way for index of dynamic ModalPopupExtender to be passed to MPE code Pin
Adam Brown 321-Jun-10 8:52
Adam Brown 321-Jun-10 8:52 
AnswerRe: Need way for index of dynamic ModalPopupExtender to be passed to MPE code Pin
Adam Brown 322-Jun-10 3:52
Adam Brown 322-Jun-10 3:52 
QuestionWebmethod needs to return string to Javascript function for processing. Pin
Hardus Lombaard21-Jun-10 4:45
Hardus Lombaard21-Jun-10 4:45 
I have a WebDayView control (proprietary Infragistics ASP.net control) in a user control. This control has a client-side click event. The click event executes a piece of Javascript which in turn calls a static webmethod in the codebehind. What I want is for this webmethod to return the string “Hello” to the Javascript function so that an alert can display it. The problem that I have is that the alert displays “undefined” instead of “Hello”. This is because the webmethod executes only after the Javascript has executed. How can I get my code to work properly so that the alert displays the returned string from the webmethod?

Cs:
[System.Web.Services.WebMethod]
public static string SetAppointmentInfo(int key)
{
return "Hello";
}

Aspx:
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
</asp:ScriptManager>
<div>
<uc1:WebUserControl ID="WebUserControl1" runat="server" />
</div>
</div>
</form>
</body>
</html>

Js:
function WebDayView1_Click(oDayView, oEvent, element) {
alert(PageMethods.SetAppointmentInfo(15, OnSucceeded, OnFailed));
}
function OnSucceeded() {
//alert("Succeeded");
}
function OnFailed() {
alert("Failed");
}

Cs (user control):
protected void Page_Load(object sender, EventArgs e)
{
this.WebScheduleSqlClientProvider1.Connect("Database=cmRMI;Server=processor;user id=hardus;password=hardus");
this.WebDayView1.ClientEvents.Click = "WebDayView1_Click"; //register click event
}

Aspx (user control):
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
<Scripts>
<asp:ScriptReference path="~/scripts/JScript.js" />
</Scripts>
</asp:ScriptManagerProxy>
<igsch:WebScheduleInfo ID="WebScheduleInfo1" runat="server"
onactivityadded="WebScheduleInfo1_ActivityAdded"
onactivitydeleted="WebScheduleInfo1_ActivityDeleted" onactivityupdated="WebScheduleInfo1_ActivityUpdated" >
</igsch:WebScheduleInfo>
<p>
<ig_scheduledata:WebScheduleSqlClientProvider ID="WebScheduleSqlClientProvider1"
runat="server" WebScheduleInfoID="WebScheduleInfo1" StyleSetName=""
StyleSetPath="" StyleSheetDirectory="">
</ig_scheduledata:WebScheduleSqlClientProvider>
</p>
<igsch:WebDayView ID="WebDayView1" runat="server"
WebScheduleInfoID="WebScheduleInfo1" StyleSetName="" StyleSetPath=""
StyleSheetDirectory=""
StyleSheetFileName="C:/Users/Hardus/Documents/Visual Studio 2008/WebSites/toets/ig_res/ElectricBlue/ig_dayview.css">
</igsch:WebDayView>
<igmisc:WebPageStyler ID="WebPageStyler1" runat="server"
StyleSetName="Default" />
AnswerRe: Webmethod needs to return string to Javascript function for processing. Pin
Not Active21-Jun-10 6:40
mentorNot Active21-Jun-10 6:40 
GeneralRe: Webmethod needs to return string to Javascript function for processing. Pin
Hardus Lombaard21-Jun-10 20:06
Hardus Lombaard21-Jun-10 20:06 
GeneralRe: Webmethod needs to return string to Javascript function for processing. Pin
Not Active22-Jun-10 1:34
mentorNot Active22-Jun-10 1:34 
GeneralRe: Webmethod needs to return string to Javascript function for processing. Pin
Hardus Lombaard22-Jun-10 1:38
Hardus Lombaard22-Jun-10 1:38 
Questionasp.net smtp error Pin
aamirzada1221-Jun-10 3:03
aamirzada1221-Jun-10 3:03 
AnswerRe: asp.net smtp error Pin
Not Active21-Jun-10 3:11
mentorNot Active21-Jun-10 3:11 
Answer[Cross-post] asp.net smtp error Pin
Sandeep Mewara22-Jun-10 5:05
mveSandeep Mewara22-Jun-10 5:05 
QuestionUsing Ajax control in User Control (ascx) [modified] Pin
-Muc_21-Jun-10 2:37
-Muc_21-Jun-10 2:37 
AnswerRe: Using Ajax control in User Control (ascx) Pin
Not Active21-Jun-10 3:01
mentorNot Active21-Jun-10 3:01 
AnswerRe: Using Ajax control in User Control (ascx) Pin
Not Active21-Jun-10 3:05
mentorNot Active21-Jun-10 3:05 
GeneralRe: Using Ajax control in User Control (ascx) Pin
-Muc_21-Jun-10 3:09
-Muc_21-Jun-10 3:09 
GeneralRe: Using Ajax control in User Control (ascx) Pin
Not Active21-Jun-10 3:12
mentorNot Active21-Jun-10 3:12 
GeneralRe: Using Ajax control in User Control (ascx) Pin
-Muc_21-Jun-10 4:37
-Muc_21-Jun-10 4:37 
GeneralRe: Using Ajax control in User Control (ascx) Pin
-Muc_21-Jun-10 7:33
-Muc_21-Jun-10 7:33 
GeneralRe: Using Ajax control in User Control (ascx) Pin
Not Active21-Jun-10 11:07
mentorNot Active21-Jun-10 11:07 
GeneralRe: Using Ajax control in User Control (ascx) Pin
-Muc_21-Jun-10 11:20
-Muc_21-Jun-10 11:20 
GeneralRe: Using Ajax control in User Control (ascx) Pin
Not Active21-Jun-10 11:42
mentorNot Active21-Jun-10 11:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.