This is a migrated thread and some comments may be shown as answers.

AspDotNetStorefront will support ajaxradcombobox

1 Answer 43 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Rachana
Top achievements
Rank 1
Rachana asked on 07 Jun 2012, 10:04 AM
Actually my application is ECOM application....am using third party tool AspDotNetStoreFront..in one of my page using radcombobox, onloadondemand binding the data form the dataset for more details refer the following link http://demos.telerik.com/aspnet-ajax/combobox/examples/populatingwithdata/autocompletesql/defaultcs.aspx. and calling the ajax method from javascript.
I am using the .net frame work 3.5,actually i added telerik reference in web.config in between <handlers>

<add name="Telerik.Web.UI.WebResource" path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" />

and ajax reference
<location path="ajaxpro">
    <system.webServer>
      <handlers>
        <add verb="*" path="*.ashx" name="AjaxPro" type="AjaxPro.AjaxHandlerFactory,AjaxPro.2" />
      </handlers>
    </system.webServer>
  </location>
my problem is that in chrome combobox is not working means to say dropdown is not diplaying and on combo load am calling javascript function that also not happening ,onselected event is not  happening  and mozilla combobox part is working but ajax methods are not calling...am struggling for this days together but i dn't get solution ...finally i got doubt is it AspDotNetStoreFront will support rad contols and ajax?can anybody plz help out this ,below is my aspx page
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="preregistration.aspx.cs" Inherits="PreRegistration" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head id="hdPreRegistration" runat="server">
<meta http-equiv="X-UA-Compatible" content="IE=7" />
    <title>Student Registration</title>
    <script language="javascript" type = "text/javascript" src = "commonfunctions.js"></script>
    <link type='text/css' rel='stylesheet' href ="ecfstyle.css" />
   
</head>
<body >
    <form id="frmPreRegistration" method="post" runat="server">
    <asp:Panel ID="pnlPreRegistration" runat="server">
        <input type ="hidden" id="CourseID" runat="server"/>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
        <asp:Table ID="tblPreRegistration" CellSpacing="0" CellPadding="2" Width="100%" runat="server">
            <asp:TableRow>
                <asp:TableCell HorizontalAlign="left" VerticalAlign="top">
                    <asp:Image runat="server" ID="imgHdr" /><br />
                    <asp:Table ID="tblPreRegOuter" CellSpacing="0" CellPadding="2" Width="100%" runat="server">
                        <asp:TableRow>
                            <asp:TableCell HorizontalAlign="left" VerticalAlign="top">
                                <table width="100%">
                                    <tr id="trError" runat="server" visible="false">
                                        <td align="left" colspan="2">
                                            <asp:Label ID="lblError" runat="server" Style="font-family: Verdana; font-size: 11;
                                                font-weight: bold" ForeColor="Red"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr id="trNoData" runat="server">
                                        <td align="left" colspan="2">
                                            <asp:Label ID="lblNoData" runat="server" Style="font-family: Verdana; font-size: 11;
                                                font-weight: bold; color: Blue"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr id="trStateCombo" runat="server" height="25px">
                                        <td width="25%" align="right">
                                            <asp:Label ID="lblState" runat="server" Text="State"></asp:Label>: 
                                        </td>
                                        <td align="left" width="75%">
                                             <telerik:RadComboBox ID="RadComboState" runat="server" Width="250px" Height="150px"
                                                EmptyMessage="Select a state" OnClientLoad="onLoad" EnableLoadOnDemand="True" ShowMoreResultsBox="true"
                                                EnableVirtualScrolling="true"  OnItemsRequested="RadComboState_ItemsRequested"
                                                OnClientSelectedIndexChanging="LoadInstitutionList">
                                            </telerik:RadComboBox>
                                        </td>
                                    </tr>
                                    <tr id="trInstitutionCombo" runat="server" height="25px">
                                        <td align="right" width="25%">
                                            <asp:Label ID="lblSelectInstitution" runat="server">Institution</asp:Label>: 
                                        </td>
                                        <td align="left" width="75%">
                                            <telerik:RadComboBox ID="RadComboInstitution" runat="server" Width="250px" Height="150px"
                                                EmptyMessage="Select an institution" EnableLoadOnDemand="True" ShowMoreResultsBox="true"
                                                  EnableVirtualScrolling="true" OnItemsRequested="RadComboInstitution_ItemsRequested"
                                                  OnClientSelectedIndexChanging="LoadTermList">
                                            </telerik:RadComboBox>
                                        </td>
                                    </tr>
                                    <tr id="trTermCombo" runat="server" height="25px">
                                        <td align="right">
                                            <asp:Label ID="lblSelectTerm" runat="server" Text="Term"></asp:Label>: 
                                        </td>
                                        <td align="left">
                                          <telerik:RadComboBox ID="RadComboTerm" runat="server" Width="250px" Height="150px"
                                                EmptyMessage="Select a term" OnClientLoad="onLoad" EnableLoadOnDemand="True" ShowMoreResultsBox="true"
                                                EnableVirtualScrolling="true" OnItemsRequested="RadComboTerm_ItemsRequested"
                                                OnClientSelectedIndexChanging="LoadCourseList" >
                                            </telerik:RadComboBox>
                                        </td>
                                    </tr>
                                    <tr id="trCourseCombo" runat="server" height="25px">
                                        <td align="right">
                                            <asp:Label ID="lblSelectCourse" runat="server" Text="Course"></asp:Label>: 
                                        </td>
                                        <td align="left">
                                           <telerik:RadComboBox ID="RadComboCourse" runat="server" Width="250px" Height="150px"
                                                EmptyMessage="Select a course" EnableLoadOnDemand="True" ShowMoreResultsBox="true"
                                                EnableVirtualScrolling="true" OnItemsRequested="RadComboCourse_ItemsRequested"
                                                OnClientSelectedIndexChanging="LoadSectionList">
                                            </telerik:RadComboBox>
                                              
                                            <asp:LinkButton ID="lbnViewCourse"  OnClientClick="OpenCourse();" runat="server">View Course</asp:LinkButton>
                                        </td>
                                    </tr>
                                    <tr id="trSectionCombo" runat="server" height="25px">
                                        <td align="right">
                                            <asp:Label ID="lblSection" runat="server">Section</asp:Label>: 
                                        </td>
                                        <td align="left">
                                            <telerik:RadComboBox ID="RadComboSection" runat="server" Width="250px" Height="150px"
                                                        EmptyMessage="Select a section" OnClientSelectedIndexChanged="OnClientSelectedIndexChangedEventHandler"
                                                        EnableLoadOnDemand="True" ShowMoreResultsBox="true" EnableVirtualScrolling="true"
                                                        OnItemsRequested="RadComboSection_ItemsRequested">
                                             </telerik:RadComboBox>
                                        </td>
                                    </tr>
                                    <tr id="trInstName" runat="server" height="25px">
                                        <td align="right">
                                            <asp:Label ID="lblInstructorNameHdr" runat="server">Instructor Name</asp:Label>: 
                                        </td>
                                        <td align="left">
                                            <asp:Label ID="lblInstructorName" runat="server"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr id="trLocation" runat="server" height="25px">
                                        <td align="right">
                                            <asp:Label ID="lblLocationHdr" runat="server">Location</asp:Label>: 
                                        </td>
                                        <td align="left">
                                            <asp:Label ID="lblLocation" runat="server"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr id="trTiming" runat="server" height="25px">
                                        <td align="right">
                                            <asp:Label ID="lblTimingHdr" runat="server">Time</asp:Label>: 
                                        </td>
                                        <td align="left">
                                            <asp:Label ID="lblTiming" runat="server"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr id="trInsFreeTime" runat="server" height="25px">
                                        <td align="right">
                                            <asp:Label ID="lblInsFreeTime" runat="server">Free Time</asp:Label>: 
                                        </td>
                                        <td align="left">
                                            <asp:Label ID="lblFreeTime" runat="server"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr id="trNext" runat="server">
                                        <td align="Center" colspan="2">
                                            <asp:Button ID="btnNext" runat="server" CssClass="ecfStyleButton" Width="75px" OnClick="btnNext_Click" Text="Continue" />
                                        </td>
                                    </tr>
                                </table><br/><br/>
                            </asp:TableCell>
                        </asp:TableRow>
                    </asp:Table>
                </asp:TableCell>
            </asp:TableRow>
        </asp:Table>
    </asp:Panel>
    </form>
     <script type="text/javascript">
         function GetSelectedState(sender, eventArgs) {
             var SelectedState;
             var combo = Telerik.Web.UI.RadComboBox.ComboBoxes[0];
             SelectedState = combo.get_value();
             var context = eventArgs.get_context();
             context["StateId"] = SelectedState;
         }
         function GetSelectedInstitution(sender, eventArgs) {
             var SelectedInstitution;
             var combo = Telerik.Web.UI.RadComboBox.ComboBoxes[1];
             SelectedInstitution = combo.get_value();
             var context = eventArgs.get_context();
             context["InstId"] = SelectedInstitution;
         }
         function onLoad(sender) {
             document.getElementById('trInstName').style.visibility = "hidden";
             document.getElementById('trLocation').style.visibility = "hidden";
             document.getElementById('trTiming').style.visibility = "hidden";
             document.getElementById('trInsFreeTime').style.visibility = "hidden";
             document.getElementById('trNext').style.visibility = "hidden";
             document.getElementById('lbnViewCourse').style.visibility = "hidden";
 
         }
         function LoadInstitutionList(sender, eventArgs) {
 
             var item = eventArgs.get_item();
             var CboInstitution = Telerik.Web.UI.RadComboBox.ComboBoxes[1];
             CboInstitution.set_text("select an instution");
             if (item.get_index() >= 0) {
                 CboInstitution.requestItems(item.get_value(), false);
             }
             else {
                 CboInstitution.set_text(" ");
                 CboInstitution.clearItems();
             }
         }
         function LoadTermList(sender, eventArgs) {
             var item = eventArgs.get_item();
             var CboTerm = Telerik.Web.UI.RadComboBox.ComboBoxes[2];
             CboTerm.set_text("select a term");
             if (item.get_index() >= 0) {
                 CboTerm.requestItems(item.get_value(), false);
             } else {
                 CboTerm.set_text(" ");
                 CboTerm.clearItems();
             }
         }
         function LoadCourseList(sender, eventArgs) {
             var item = eventArgs.get_item();
             var length = Telerik.Web.UI.RadComboBox.ComboBoxes.length;
             if (length == 5)
                 var CboCourse = Telerik.Web.UI.RadComboBox.ComboBoxes[3];
             else {
                 var CboCourse = Telerik.Web.UI.RadComboBox.ComboBoxes[1];
             }
 
             CboCourse.set_text("select a course");
             if (item.get_index() >= 0) {
                 CboCourse.requestItems(item.get_value(), false);
             }
             else {
                 CboCourse.set_text(" ");
                 CboCourse.clearItems();
             }
         }
         function LoadSectionList(sender, eventArgs) {
             var item = eventArgs.get_item();
             var CboSection = Telerik.Web.UI.RadComboBox.ComboBoxes[4];
             CboSection.set_text("select a section");
             if (item.get_index() >= 0) {
                 CboSection.requestItems(item.get_value(), false);
                 document.getElementById('CourseID').value = item.get_value();
             }
             else {
                 CboSection.set_text(" ");
                 CboSection.clearItems();
             }
         }
         function ChangeSection(SectionID) {
             if (SectionID != '-1') {
                 document.getElementById('lbnViewCourse').style.visibility = "visible";
                 document.getElementById('trInstName').style.visibility = "visible";
                 document.getElementById('trLocation').style.visibility = "visible";
                 document.getElementById('trTiming').style.visibility = "visible";
                 document.getElementById('trInsFreeTime').style.visibility = "visible";
                 document.getElementById('trNext').style.visibility = "visible";
                 var Data = ECOM_preregistration.getSectionDetails(SectionID).value;
                 if (Data == 0 || Data == null) {
                     document.getElementById('lblInstructorName').innerHTML = 'Not Specified';
                     document.getElementById('lblLocation').innerHTML = 'Not Specified';
                     document.getElementById('lblTiming').innerHTML = 'Not Specified';
                     document.getElementById('lblFreeTime').innerHTML = 'Not Specified';
                 } else {
                     var mySplitResult = Data.split("$");
                     if (mySplitResult[0].length == "0")
                         document.getElementById('lblTiming').innerHTML = 'Not Specified';
                     else
                         document.getElementById('lblTiming').innerHTML = mySplitResult[0];
                     ;
                     if (mySplitResult[1].length == "0") {
                         document.getElementById('lblLocation').innerHTML = 'Not Specified';
                     } else {
                         document.getElementById('lblLocation').innerHTML = mySplitResult[1];
                     }
                     if (mySplitResult[2].length == "0") {
                         document.getElementById('lblInstructorName').innerHTML = 'Not Specified';
                     } else {
                         document.getElementById('lblInstructorName').innerHTML = mySplitResult[2];
                     }
                     if (mySplitResult[3].length == "0") {
                         document.getElementById('lblFreeTime').innerHTML = 'Not Specified';
                     } else {
                         document.getElementById('lblFreeTime').innerHTML = mySplitResult[3];
                     }
                 }
             }
         }
         function OnClientSelectedIndexChangedEventHandler(sender, args) {
             var item = args.get_item();
             ChangeSection(item.get_value());
         }
         function OpenCourse() {
             var URl = ECOM_preregistration.getCourseDetails(document.getElementById('CourseID').value).value;
         }
    </script>
</body>
</html>
and aspx.cs file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;
using Educo.ELS.Course;
using Educo.ELS.Encryption;
using Educo.ELS.Portal;
using Educo.ELS.SystemSettings;
using Educo.ELS.Users;
using Telerik.Web.UI;
using AjaxPro;
using Educo.ELS.ErrorPublisher;
using Educo.QueryString;
 
 
public partial class preregistration : System.Web.UI.Page
{
    //Variables
    const char colSep = (char)195;
    string langFile = "Strings-En".ToString();
    int flagSuccess = 0;
    string institutionId = string.Empty;
    string bookBased = string.Empty;
    string ecfPath = string.Empty;
    private const int ItemsPerRequest = 10;
 
    //Objects
    SecureQueryString objSecureQS;
    DataSet dstRegistration;
    StringBuilder paramList = null;
    LocationSettings objState;
    Course objCourse;
    EncryptDecrypt objEncrypt;
    Portal objPortal;
    User objUser;
    CourseSetting objCourseSetting;
 
    private void Page_Load(object sender, System.EventArgs e)
    {
        try
        {
            AjaxPro.Utility.RegisterTypeForAjax(typeof(preregistration),this.Page);
            Handling Path and style for title image and table
            imgHdr.ImageUrl = AppLogic.LocateImageURL("skins/skin_1/images/studentregistration.gif");
            tblPreRegOuter.Attributes.Add("style", AppLogic.AppConfig("BoxFrameStyle"));
          }
        catch (Exception error)
        {
            publishError(error);
        }
    }
 
    
 
    
 
    private DataSet PoulateStates()
    {
        //Objects
        dstRegistration = new DataSet();
        objState = new LocationSettings();
        paramList = new StringBuilder();
        paramList.Length = 0;
        int eduType = 0;
 
       
            RadComboState.Items.Clear();
 
             
 
           // if (ViewState["PORTALID"] != null && ViewState["COUNTRY"] != null && Session["EDUTYPE"] != null)
            if (ViewState["PORTALID"] != null && ViewState["COUNTRY"] != null )
            {
 
                trStateCombo.Visible = true;
                paramList.Append("1").Append(colSep).Append(ViewState["COUNTRY"].ToString());
                paramList.Append(colSep).Append("6").Append(colSep).Append(ViewState["PORTALID"].ToString());
 
                //7th Parameter only for schools
                string edType = "";
                if (Session["EDUTYPE"] != null)
                {
                    edType = Session["EDUTYPE"].ToString();
                }
 
                if (edType.Length > 1 && edType.Substring(1, 1) == "H")
                {
                    eduType = 1;
                }
 
                if (ViewState["COUNTRYNAME"].ToString().Substring(0, 2) == "ME")
                {
                    trStateCombo.Visible = false;
                }
                paramList.Append(colSep).Append("7").Append(colSep).Append(eduType);
                dstRegistration = objState.GetStates(paramList.ToString(), langFile);
                
            }
        return dstRegistration;
    }
 
    private DataSet populateInstitution(string StateId)
    {
        //Objects
        dstRegistration = new DataSet();
        objCourse = new Course();
        paramList = new StringBuilder();
        paramList.Length = 0;
 
        
        trInstitutionCombo.Visible = true;
        RadComboInstitution.Items.Clear();
         
       // if (RadComboState.SelectedValue != "-1" && ViewState["PORTALID"] != null && ViewState["COUNTRY"] != null && Session["EDUTYPE"] != null)
       // if (ViewState["PORTALID"] != null && ViewState["COUNTRY"] != null && Session["EDUTYPE"] != null)
          if (ViewState["PORTALID"] != null && ViewState["COUNTRY"] != null)
        {
            paramList.Append("1").Append(colSep).Append(ViewState["PORTALID"].ToString()).Append(colSep);
            paramList.Append("4").Append(colSep).Append(StateId).Append(colSep);
            paramList.Append("6").Append(colSep).Append("1");
            if (ViewState["COUNTRYNAME"].ToString().ToUpper() == "USA")
            {
                if (Session["EDUTYPE"].ToString() == "UH")
                    paramList.Append(colSep).Append("7").Append(colSep).Append(1);
                else
                    paramList.Append(colSep).Append("7").Append(colSep).Append(0);
            }
            else if (ViewState["COUNTRYNAME"].ToString().ToUpper() == "JAMAICA")
            {
                if (Session["EDUTYPE"].ToString() == "JH")
                    paramList.Append(colSep).Append("7").Append(colSep).Append(1);
                else
                    paramList.Append(colSep).Append("7").Append(colSep).Append(0);
            }
            else if (ViewState["COUNTRYNAME"].ToString().ToUpper() == "PHILIPPINES")
            {
                if (Session["EDUTYPE"].ToString() == "PH")
                    paramList.Append(colSep).Append("7").Append(colSep).Append(1);
                else
                    paramList.Append(colSep).Append("7").Append(colSep).Append(0);
            }
            else if (ViewState["COUNTRYNAME"].ToString().ToUpper() == "INDIA")
            {
                paramList.Append(colSep).Append("7").Append(colSep).Append(0);
            }
            else if (ViewState["COUNTRYNAME"].ToString().Substring(0, 2) == "ME")
            {
                paramList.Append(colSep).Append("7").Append(colSep).Append(0);
            }
            else if (ViewState["COUNTRYNAME"].ToString().ToUpper() == "MARSHALL ISLANDS")
            {
                if (Session["EDUTYPE"].ToString() == "MH")
                    paramList.Append(colSep).Append("7").Append(colSep).Append(1);
                else
                    paramList.Append(colSep).Append("7").Append(colSep).Append(0);
            }
            else if (ViewState["COUNTRYNAME"].ToString().ToUpper() == "NIGERIA")
            {
                if (Session["EDUTYPE"].ToString() == "NH")
                    paramList.Append(colSep).Append("7").Append(colSep).Append(1);
                else
                    paramList.Append(colSep).Append("7").Append(colSep).Append(0);
            }
            dstRegistration = objCourse.GetInstitutionList(paramList.ToString(), langFile);
        }
        return dstRegistration;
    }
 
    private DataSet populateTerm(string InstId)
    {
     
    //Objects
    dstRegistration = new DataSet();
    objCourse = new Course();
    paramList = new StringBuilder();
    paramList.Length = 0;
 
        trTermCombo.Visible = true;
        RadComboTerm.Items.Clear();
        if (RadComboInstitution.SelectedValue != "-1")
        {
            paramList.Append("1").Append(colSep).Append("").Append(colSep);
            if(RadComboInstitution.SelectedValue != "")
                paramList.Append("2").Append(colSep).Append(RadComboInstitution.SelectedValue).Append(colSep);
            else
                paramList.Append("2").Append(colSep).Append(InstId).Append(colSep);
            paramList.Append("3").Append(colSep).Append("CC");
 
            dstRegistration = objCourse.GetTerms(paramList.ToString(), langFile);
 
             
        }
        return dstRegistration;
 
    }
 
    private DataSet PopulateCourse(string TermId)
    {
         
        //Objects
        dstRegistration = new DataSet();
        objCourse = new Course();
        paramList = new StringBuilder();
        paramList.Length = 0;
 
       if (RadComboCourse.Enabled)
            {
                trCourseCombo.Visible = true;
                RadComboCourse.Items.Clear();
                 
 
                if (RadComboTerm.SelectedValue != "-1")
                {
                    if (ViewState["CALLEDFROM"] != null && ViewState["CALLEDFROM"].ToString() == "REP") //Inside Repeat
                    {
                        if (ViewState["USERID"] != null && ViewState["USERID"].ToString() != "0")
                        {
                            paramList.Append("1").Append(colSep).Append(TermId).Append(colSep);
                            paramList.Append("6").Append(colSep).Append("2").Append(colSep);
                            paramList.Append("7").Append(colSep).Append(ViewState["USERID"].ToString());
                            dstRegistration = objCourse.GetCourseForApproval(paramList.ToString(), langFile);
                        }
                    }
                    else if (ViewState["CALLEDFROM"] != null && ViewState["CALLEDFROM"].ToString() == "ADD")//Inside Add
                    {
                        if (ViewState["USERID"] != null && ViewState["USERID"].ToString() != "0")
                        {
                            paramList.Append("1").Append(colSep).Append(TermId).Append(colSep);
                            paramList.Append("6").Append(colSep).Append("1").Append(colSep);
                            paramList.Append("7").Append(colSep).Append(ViewState["USERID"].ToString());
                            dstRegistration = objCourse.GetCourseForApproval(paramList.ToString(), langFile);
                        }
                    }
                    else //Outside
                    {
                        paramList.Append("1").Append(colSep).Append(TermId).Append(colSep);
                        paramList.Append("2").Append(colSep).Append("SE");
                        dstRegistration = objCourse.GetCourseForApproval(paramList.ToString(), langFile);
                    }
 
                    
                }
            }
        return dstRegistration;
    }
 
    private DataSet PopulateSection(string CourseId)
    {
        
        //Objects
        dstRegistration = new DataSet();
        objCourse = new Course();
        paramList = new StringBuilder();
        paramList.Length = 0;
 
 
            trSectionCombo.Visible = true;
            RadComboSection.Items.Clear();
             
            if (RadComboTerm.SelectedValue != "-1" && RadComboCourse.SelectedValue != "-1")
            {
                paramList.Append("2").Append(colSep).Append(Session["TermId"].ToString()).Append(colSep);
                paramList.Append("3").Append(colSep).Append(CourseId);
                dstRegistration = objCourse.GetSection(paramList.ToString(), langFile);
 
                
            }
        return dstRegistration;
    }
 
     private  string GetStatusMessage(int offset, int total)
    {
        if (total <= 0)
            return "No matches";
 
        return String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", offset, total);
    }
 
    protected void RadComboState_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
    {
        RadComboState.Items.Clear();
        DataSet data = PoulateStates();
        if (data.Tables.Count > 0 && data.Tables[0].Rows[0][0].ToString() == "0")
        {
            int itemOffset = e.NumberOfItems;
            int endOffset = Math.Min(itemOffset + ItemsPerRequest, data.Tables[0].Rows.Count);
            e.EndOfItems = endOffset == data.Tables[0].Rows.Count;
            for (int i = itemOffset; i < endOffset; i++)
            {
                RadComboState.Items.Add(new RadComboBoxItem(data.Tables[0].Rows[i]["State_Name"].ToString(),
                                                            data.Tables[0].Rows[i]["intPkVal"].ToString()));
            }
 
            e.Message = GetStatusMessage(endOffset, data.Tables[0].Rows.Count);
        }
        else
        {
            RadComboBoxItem item = new RadComboBoxItem();
            item.Value = "-1";
            if (Session["COUNTRY"] != null && Session["COUNTRY"].ToString().ToUpper() == "MARSHALL ISLANDS")
                item.Text = "No Island Exists";
            else
            item.Text = "No State Exists";
            RadComboState.Items.Add(item);
        }
    }
 
    protected void RadComboInstitution_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
    {
        RadComboInstitution.Items.Clear();
       // string StateId = e.Context["StateId"].ToString();
        if ((RadComboState.SelectedValue != null && RadComboState.SelectedValue != "-1") || (e.Text.ToString() != "" && e.Text.ToString() != "-1"))
        //if (e.Text.ToString() != "" && e.Text.ToString() !="-1")
        {
            DataSet Institution = populateInstitution(e.Text);
            if (Institution.Tables[0].Rows[0][0].ToString() == "0")
            {
                int itemOffset = e.NumberOfItems;
                int endOffset = Math.Min(itemOffset + ItemsPerRequest, Institution.Tables[0].Rows.Count);
                e.EndOfItems = endOffset == Institution.Tables[0].Rows.Count;
 
                for (int i = itemOffset; i < endOffset; i++)
                {
                    RadComboInstitution.Items.Add(
                        new RadComboBoxItem(Institution.Tables[0].Rows[i]["Institution_Name"].ToString(),
                                            Institution.Tables[0].Rows[i]["InstitutionId"].ToString()));
                }
 
                e.Message = GetStatusMessage(endOffset, Institution.Tables[0].Rows.Count);
            }
            else
            {
                RadComboBoxItem item = new RadComboBoxItem();
                item.Value = "-1";
                item.Text = "No Institution Exists";
                RadComboInstitution.Items.Add(item);
            }
        }
        else
        {
            RadComboBoxItem item = new RadComboBoxItem();
            item.Value = "-1";
            item.Text = "No Institution Exists";
            RadComboInstitution.Items.Add(item);
        }
    }
 
    protected void RadComboTerm_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
    {
        RadComboTerm.Items.Clear();
        string s = RadComboInstitution.SelectedValue;
        if ((RadComboInstitution.SelectedValue != null && RadComboInstitution.SelectedValue!="-1") || (e.Text.ToString() != "" && e.Text.ToString() !="-1"))
        {
            DataSet Term = populateTerm(e.Text);
            if (Term.Tables[0].Rows[0][0].ToString() == "0")
            {
                int itemOffset = e.NumberOfItems;
                int endOffset = Math.Min(itemOffset + ItemsPerRequest, Term.Tables[0].Rows.Count);
                e.EndOfItems = endOffset == Term.Tables[0].Rows.Count;
 
                for (int i = itemOffset; i < endOffset; i++)
                {
                    RadComboTerm.Items.Add(new RadComboBoxItem(Term.Tables[0].Rows[i]["Term_Name"].ToString(),
                                                               Term.Tables[0].Rows[i]["TermId"].ToString()));
                }
 
                e.Message = GetStatusMessage(endOffset, Term.Tables[0].Rows.Count);
            }
            else
            {
                RadComboBoxItem item = new RadComboBoxItem();
                item.Value = "-1";
                item.Text = "No Term Exists";
                RadComboTerm.Items.Add(item);
            }
        }
        else
        {
            RadComboBoxItem item = new RadComboBoxItem();
            item.Value = "-1";
            item.Text = "No Term Exists";
            RadComboTerm.Items.Add(item);
        }
    }
 
    protected void RadComboCourse_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
    {
        RadComboCourse.Items.Clear();
        if (e.Text.ToString() != " " && e.Text.ToString() != "-1")
        {
            DataSet Course = PopulateCourse(e.Text);
            if (Course.Tables[0].Rows[0][0].ToString() == "0")
            {
                Session["TermId"] = e.Text;
                int itemOffset = e.NumberOfItems;
                int endOffset = Math.Min(itemOffset + ItemsPerRequest, Course.Tables[0].Rows.Count);
                e.EndOfItems = endOffset == Course.Tables[0].Rows.Count;
 
                for (int i = itemOffset; i < endOffset; i++)
                {
                    RadComboCourse.Items.Add(new RadComboBoxItem(Course.Tables[0].Rows[i]["Course_Name"].ToString(),
                                                                 Course.Tables[0].Rows[i]["CourseId"].ToString()));
                }
 
                e.Message = GetStatusMessage(endOffset, Course.Tables[0].Rows.Count);
            }
            else
            {
                RadComboBoxItem comboBoxItem = new RadComboBoxItem();
                comboBoxItem.Value = "-1";
                comboBoxItem.Text = "No Eourse Exists";
                RadComboCourse.Items.Add(comboBoxItem);
            }
        }
        else
        {
            RadComboBoxItem comboBoxItem = new RadComboBoxItem();
            comboBoxItem.Value = "-1";
            comboBoxItem.Text = "No Eourse Exists";
            RadComboCourse.Items.Add(comboBoxItem);
        }
    }
 
    protected void RadComboSection_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
    {
        RadComboSection.Items.Clear();
        //string TermId = e.Context["TermId"].ToString();
        if (e.Text.ToString() != "" && e.Text.ToString() != "-1")
        {
            DataSet Section = PopulateSection(e.Text);
            if (Section.Tables[0].Rows[0][0].ToString() == "0")
            {
                int itemOffset = e.NumberOfItems;
                int endOffset = Math.Min(itemOffset + ItemsPerRequest, Section.Tables[0].Rows.Count);
                e.EndOfItems = endOffset == Section.Tables[0].Rows.Count;
 
                for (int i = itemOffset; i < endOffset; i++)
                {
                    RadComboSection.Items.Add(new RadComboBoxItem(Section.Tables[0].Rows[i]["Section_Name"].ToString(),
                                                                  Section.Tables[0].Rows[i]["intSectionId"].ToString()));
                }
 
                e.Message = GetStatusMessage(endOffset, Section.Tables[0].Rows.Count);
            }
            else
            {
                RadComboBoxItem item = new RadComboBoxItem();
                item.Value = "-1";
                item.Text = "No Sectioon Exists";
                RadComboSection.Items.Add(item);
            }
        }
        else
        {
            RadComboBoxItem item = new RadComboBoxItem();
            item.Value = "-1";
            item.Text = "No Sectioon Exists";
            RadComboSection.Items.Add(item);
        }
    }
 
    [AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)]
    public string getCourseDetails(string CourseId)
    {
        string URL=null;
        //if (ConfigurationManager.AppSettings.Get("ECFRETURNPATH") != null)
        //{
            string productId = GetProductID(CourseId);
         //   ecfPath = ConfigurationManager.AppSettings.Get("ECFRETURNPATH").ToString();
            URL = ecfPath + "','" + productId;
       // }
        return URL;
    }
 
    [AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)]
   public string getSectionDetails(string sectionId)
    {
        string data = "dsfddg";
 
        return data;
    }
 
     
    private void disableControl(string fromModule)
    {
        trInstitutionCombo.Visible = true;
        if (ViewState["CALLEDFROM"] != null && ViewState["CALLEDFROM"].ToString() == "REP") //Inside Repeat
        {
            trInstitutionCombo.Visible = false;
        }
        trTermCombo.Visible = true;
        trSectionCombo.Visible = true;
        trCourseCombo.Visible = true;
 
        trNoData.Visible = true;
        trInstName.Visible = false;
        trTiming.Visible = false;
        trLocation.Visible = false;
        trNext.Visible = false;
        lbnViewCourse.Visible = (RadComboCourse.SelectedValue == "-1") ? false : true;
 
        if (fromModule == "true")
        {
            trNoData.Visible = false;
            trInstName.Visible = true;
            trTiming.Visible = true;
            trLocation.Visible = true;
            trNext.Visible = true;
            btnNext.Visible = true;
        }
        else if (fromModule == "NOSTATE")
        {
            trInstitutionCombo.Visible = false;
            trTermCombo.Visible = false;
            trSectionCombo.Visible = false;
            trCourseCombo.Visible = false;
        }
    }
 
    protected void btnNext_Click(object sender, EventArgs e)
    {       

    }
 
    private void publishError(Exception error)
    {
        DataSet dstError;
        CustomErrorPublisher objError = new CustomErrorPublisher();
        dstError = objError.Publish(error);
        trError.Visible = true;
        lblError.Visible = true; //THE LABEL USED TO DISPLAY THE ERROR MESSAGE
        lblError.Text = dstError.Tables[0].Rows[0][2].ToString();
        trError.Visible = true;
        objError = null;
        dstError = null;
    }
}

1 Answer, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 12 Jun 2012, 10:37 AM
Hello Rachana,

I've inspected the provided implementation, but your scenario is quite complicated so in order to troubleshoot this problem please open a support ticket and provide a runnable sample reproducing the issue so we could troubleshoot the problem locally.

Kind regards,
Dimitar Terziev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
ComboBox
Asked by
Rachana
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Share this question
or