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

Why my RadDropDownList is always Enable = false ?

1 Answer 70 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Mehdi
Top achievements
Rank 1
Mehdi asked on 24 Jul 2013, 02:14 PM
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);
 
          // .......
}

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 29 Jul 2013, 08:32 AM
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.
Tags
DropDownList
Asked by
Mehdi
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Share this question
or