Why my RadDropDownList is always Enable = false ?

2 posts, 0 answers
  1. Mehdi
    Mehdi avatar
    17 posts
    Member since:
    Jun 2012

    Posted 24 Jul 2013 Link to this post

    Hello.
    I encounter a problem with the controller [RadDropDownList].
    I built a simple table on the server side (code behind) and manually sets the client function [OnClientSelectedIndexChanged] on the controller
    [RadDropDownList].
    My problem is that my property RadDropDownList.Enabled is always equal to false. I do not understand why ... If I define no client function on [OnClientSelectedIndexChanged] , my property of my control RadDropDownList.Enabled is equal to True.

    Do you have any idea why it is impossible to define the client function [OnClientSelectedIndexChanged] without changing the Enabled property? This is boring because users can not use this controller if enable == false..

    Thanks a lot !
    Here is my code used to build my table with the control [RadDropDownList] .
    for (int a = 0; a < allAudit.GetLength(0); a++)
    {
              // .......
     
              int auditID = int.Parse(allAudit[a, 0]);
              double percent = ((double)countTotalAuditable/(double)countTotal) * 100.0;
     
              TableRow row = new TableRow() { BackColor = Color.FromArgb(215, 230, 247) };
              TableCell cell_processName = new TableCell() { HorizontalAlign = HorizontalAlign.Left,VerticalAlign = VerticalAlign.Middle };
              TableCell cell_date = new TableCell() { HorizontalAlign = HorizontalAlign.Center, VerticalAlign = VerticalAlign.Middle };
              TableCell cell_progression = new TableCell() { HorizontalAlign = HorizontalAlign.Center, VerticalAlign = VerticalAlign.Middle };
              TableCell cell_responsable = new TableCell() { HorizontalAlign = HorizontalAlign.Center,VerticalAlign = VerticalAlign.Middle };
     
              Label lblProcessName = new Label() { Text = allAudit[a, 1] };
              Label lblDate = new Label() { Text = DateTime.Parse(allAudit[a, 3]).ToLongDateString() };
              Label lblProgressionAudit = new Label() { Text = percent+" %" };
              RadDropDownList droopDownResponsable = new RadDropDownList();
              droopDownResponsable.EnableEmbeddedScripts = false;
              droopDownResponsable.ID = "droopDownResponsable";
              droopDownResponsable.ClientIDMode = System.Web.UI.ClientIDMode.Static;
              droopDownResponsable.OnClientSelectedIndexChanged = "cbx_responsible_SelectedIndexChanged("+auditID+");";
              SqlDataSource sourceUserList = new SqlDataSource(ConfigurationManager.ConnectionStrings["SCI2ConnectionString"].ToString(), "SELECT [tblUser].[userID], [UserName] FROM [aspnet_Users] INNER JOIN [tblUser] ON [aspnet_Users].[UserId] = [tblUser].[membershipID]");
     
              droopDownResponsable.DataValueField = "UserID";
              droopDownResponsable.DataTextField = "UserName";
              droopDownResponsable.DataSource = sourceUserList;
     
              droopDownResponsable.DataBind();
     
              foreach (DropDownListItem item in droopDownResponsable.Items)
              {
                    if (item.Text == allAudit[a, 2])
                    {
                          item.Selected = true;
                    }
              }
     
              cell_processName.Controls.Add(lblProcessName);
              cell_date.Controls.Add(lblDate);
              cell_progression.Controls.Add(lblProgressionAudit);
              cell_responsable.Controls.Add(droopDownResponsable);
     
              row.Cells.Add(cell_processName);
              row.Cells.Add(new TableCell() { Text = " ", Width = 20 });
              row.Cells.Add(cell_date);
              row.Cells.Add(new TableCell() { Text = " ", Width = 20 });
              row.Cells.Add(cell_progression);
              row.Cells.Add(new TableCell() { Text = " ", Width = 20 });
              row.Cells.Add(cell_responsable);
     
              tableAuditAdministration.Rows.Add(row);
     
              // .......
    }
  2. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 29 Jul 2013 Link to this post

    Hello Mehdi,

    I noticed that you are setting the EnableEmbeddedScripts property of the RadDropDownList to false. Are you referring any JavaScript resources in your markup, like demonstrated in this help article? If not, the JavaScript files will not be loaded from the assembly, which would reflect reflect as a JavaScript error and freeze the DropDownList.
     
    Regards,
    Nencho
    Telerik
    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 the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top