Infragistics NetAdvantage Control Sample Code


Overview

In my opinion, Infragistics controls are robust and beautiful. However, as much as I love the NetAdvantage control suite, they also have some issues. Even the most common functions are incredibly difficult to determine how to use. Often you find yourself doing things that way they would normally work just to find out that it doesn’t work. Then the subsequent couple of hours (at least) is spent trying to figure out where to find the information, how to get a complete (working) sample and then how to adapt that to your own situation. It gets pretty frustrating.

Anyway, so this has lead me to start this blog post. I will post working code when I get a particular functionality setup and working right. That way hopefully in the future when either I or someone else needs the same thing, hopefully it’ll save them a lot of time. No sense in reinventing the wheel each time that task needs to be done.

Add DropDownList to UltraWebGrid

protected void WebGrid1_InitializeLayout(object sender, LayoutEventArgs e)
{

ValueList myValueList = new ValueList();

myValueList.Prompt = "Select an item";
myValueList.DisplayStyle = ValueListDisplayStyle.DisplayText;

myValueList.ValueListItems.Insert(0, "Item1", "Item1");
myValueList.ValueListItems.Insert(1, "Item2", "Item2");
myValueList.ValueListItems.Insert(2, "Item3", "Item3");
myValueList.ValueListItems.Insert(3, "Item4", "Item4");
myValueList.DataBind();

e.Layout.Bands[0].Columns.Add("NewCol", "New Col");
e.Layout.Bands[0].CellClickAction = CellClickAction.Edit;
e.Layout.Bands[0].Columns.FromKey("NewCol").AllowUpdate = AllowUpdate.Yes;
e.Layout.Bands[0].Columns.FromKey("NewCol").Type = ColumnType.DropDownList;
e.Layout.Bands[0].Columns.FromKey("NewCol").DataType = "System.String";
e.Layout.Bands[0].Columns.FromKey("NewCol").ValueList = myValueList;

}

Set UltraWebGrid Template Column Button Text

protected void grdCustomerList_InitializeRow(object sender, RowEventArgs e)
{

e.Row.Cells.FromKey("Locations").Text = "L";
e.Row.Cells.FromKey("Orders").Text = "O";
e.Row.Cells.FromKey("Hardware").Text = "H";
e.Row.Cells.FromKey("Consumables").Text = "C";
e.Row.Cells.FromKey("Training").Text = "T";

}

Summary

There will be more code samples to follow. As I come across more situations where I have to take the time to research and come up with solutions to do these common tasks, I will add them to this article. If you like these and they’re useful, make sure to comment on the article so I know.

Advertisements

2 thoughts on “Infragistics NetAdvantage Control Sample Code

    1. Jayaraj,

      Hi there. I wish I could give you more detailed instructions, but adding the control suite to your web application consists of a lot of steps. Also, setup depends on which controls you want to use. There’s no way to explain this all in a comment reply.

      The best thing to do would be to consult the online documentation that comes with the control suite. Once you install the NetAdvantage control suite on your development system, there should be an item under the new start menu entry for online documentation. Follow this link, then select the appropriate version you have and find the topic for getting started and developing with it.

      I hope this helps!
      Nathon

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s