Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
Adding a DropDownList to UltraWebGrid Column
posted

Hi Everyone,

 I am having some REAL difficulty with getting a DropDownList to appear in an UltraWebGrid column.  I have searched far and wide for the correct way to setup a DropDownList and for some reason I cannot get to dropdown list to appear even in an overly simple senario.   

 I have followed these approaches: http://forums.infragistics.com/forums/t/14767.aspx , http://news.infragistics.com/forums/t/9063.aspx, http://news.infragistics.com/forums/p/11438/43300.aspx#43300 , http://news.infragistics.com/forums/p/10880/41315.aspx#41315

 Furthermore, I have run the example http://devcenter.infragistics.com/download/samples/kb/webgridcomplexrowtemplate.zip in which the grid still doesn't show a dropdown (or rowedittemplate).

 I have set up a VERY simple example where I just try to create a drop down list in a page load and bind but still nothing shows, here is the logic:

protected void Page_Load(object sender, EventArgs e)

{

UltraGridBand b = this.UltraWebGrid1.Bands[0]; b.Columns.Insert(0, "Ver");

UltraGridColumn c = b.Columns[0];

c.Type = ColumnType.DropDownList;

c.Header.Caption = "code-behind";

c.DataType = System.Type.GetType("System.Int32").ToString();

List<Class1> cl1 = new List<Class1>(0);

cl1.Add(new Class1(1, "P1"));cl1.Add(new Class1(2, "P2"));

c.ValueList.DataSource = cl1;

c.ValueList.DisplayMember = "Name";

c.ValueList.DataMember = "Id";

c.ValueList.DataSourceID = "Id";

c.ValueList.DataBind();

}

Where class1 has two members, Id and Name.  I get a column called "code-behind" but no dropdownlist.

 

Can someone please shed some light on what I am missing?

 

Thanks for any help,

 Jason

 

Parents
  • 45049
    posted

    I haven't tested your code, but I see one line that jumps out at me:

    c.ValueList.DataMember = "Id";

    Try removing this line and see if it works.  This property is used in combination with the DataSource property to specify a given list within a set of lists (such as the name of a DataTable within a DataSet).

    Is your WebGrid databound?  If so, then I suggest moving this logic to the InitializeLayout event, so that you know it'll be called when the grid is databound.  Use "e.Layout.Bands[0]" to get a reference to your band in this event handler.

Reply Children