Click event of WebDayView in user control doesn't work
-
I have a webdayview control (proprietary Infragistics ASP.net control) on my page. On the aspx source I’ve inserted some javascript (webdayview_click) that calls a webmethod in the codebehind. This seems to work fine, but when I insert this webdayview control into a user control and move the corresponding javascript into the aspx of the user control, it doesn’t work. I can’t even insert a breakpoint into the javascript function to debug it. Is there a way to make it work? I want to enable the click event of the webdayview control so that when I click on it, the javascript function calls the webmethod. Here’s my code (remember it's in a user control): Aspx: <!-- function WebDayView1_Click(oDayView, oEvent, element) { PageMethods.SetAppointmentInfo(oDayView.getSelectedActivity().getDataKey()) } // -->
Cs: public partial class WebUserControl : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { this.WebScheduleSqlClientProvider1.Connect("Database=cmRMI;Server=processor;user id=hardus;password=hardus"); } [System.Web.Services.WebMethod] public static void SetAppointmentInfo(int key) { //Add code here } }
-
I have a webdayview control (proprietary Infragistics ASP.net control) on my page. On the aspx source I’ve inserted some javascript (webdayview_click) that calls a webmethod in the codebehind. This seems to work fine, but when I insert this webdayview control into a user control and move the corresponding javascript into the aspx of the user control, it doesn’t work. I can’t even insert a breakpoint into the javascript function to debug it. Is there a way to make it work? I want to enable the click event of the webdayview control so that when I click on it, the javascript function calls the webmethod. Here’s my code (remember it's in a user control): Aspx: <!-- function WebDayView1_Click(oDayView, oEvent, element) { PageMethods.SetAppointmentInfo(oDayView.getSelectedActivity().getDataKey()) } // -->
Cs: public partial class WebUserControl : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { this.WebScheduleSqlClientProvider1.Connect("Database=cmRMI;Server=processor;user id=hardus;password=hardus"); } [System.Web.Services.WebMethod] public static void SetAppointmentInfo(int key) { //Add code here } }
Please use PRE tags to format your code part. It really helps everyone to read and answer questions.
Hardus Lombaard wrote:
insert this webdayview control into a user control and move the corresponding javascript into the aspx of the user control, it doesn’t work.
This means you have not taken care of the control names in Javascript. Once you put the control in a user control, a string would append at the start of your control name. This new ID which can be found out easily using a ViewSource of your webpage, must be used in Javascript to access it.
Hardus Lombaard wrote:
. I can’t even insert a breakpoint into the javascript function to debug it.
Why so? You can put "debugger;" at the start of function and enable Javascript debugging in your IE settings! You are all set to debug it now.