Chart controls from Microsoft for VS 2008

Finally, there is addon Chart control from Microsoft fro Visual Studion 2008. You can download the Chart Controls from:
http://www.microsoft.com/downloads/details.aspx?FamilyID=130f7986-bf49-4fe5-9ca8-910ae6ea442c&DisplayLang=en
(Microsoft Chart Controls  for Microsoft Framework 3.5)
and http://www.microsoft.com/downloads/details.aspx?familyid=1D69CE13-E1E5-4315-825C-F14D33A303E9&displaylang=en
(Microsoft Chart Controls Add-on for Microsoft Visual Studio 2008).
I have used Dundas Chart Control for my previous projects with professional licence. It is a very nice control if you want to buy the licence. You can desing your chart visually with the Dundas wizard and you can get your chart ready in minutes. You can try the full function product free (with watermark on your charts while you are testing).
I have downloaded the sample environment for working with Microsoft Chart Controls. You can download the source code of the sample project here:
http://code.msdn.microsoft.com/mschart/Release/ProjectReleases.aspx?ReleaseId=1591
If you have issues about the control, you can post your question at MSDN forum:
http://social.msdn.microsoft.com/Forums/en-US/MSWinWebChart/threads/#page:1
 

Cascading DropDowLists for ListView editing and inserting

Here is a sample code for working with cascading dropdownlists in editing and inserting with the new ListView data control.
I updated the code for the released version.

<asp:ListView ID="ListView1" runat="server" DataKeyNames="CustomerId" OnItemInserting="ListView1_OnItemInserting"

OnItemUpdating="ListView1_ItemUpdating"

DataSourceID="SqlDataSource1" InsertItemPosition="LastItem">

<AlternatingItemTemplate>

<tr runat="server" style="">

<td>

<asp:Button ID="DeleteButton" runat="server" CommandName="Delete"

Text="Delete" />

<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />

</td>

<td>

<asp:Label ID="CustomerIdLabel" runat="server"

Text=’<%# Eval("CustomerId") %> />

</td>

<td>

<asp:Label ID="NameLabel" runat="server" Text=’<%# Eval("Name") %> />

</td>

<td>

<asp:Label ID="ManufactureLabel" runat="server"

Text=’<%# Eval("Manufacture") %> />

</td>

<td>

<asp:Label ID="ModelLabel" runat="server" Text=’<%# Eval("Model") %> />

</td>

</tr>

</AlternatingItemTemplate>

<LayoutTemplate>

<table id="Table1" runat="server">

<tr id="Tr1" runat="server">

<td id="Td1" runat="server">

<table ID="itemPlaceholderContainer" runat="server" border="0" style="">

<tr id="Tr2" runat="server" style="">

<th id="Th1" runat="server">

</th>

<th id="Th2" runat="server">

CustomerID

</th>

<th id="Th3" runat="server">

Name

</th>

<th id="Th4" runat="server">

Manufacturer

</th>

<th id="Th5" runat="server">

Model

</th>

</tr>

<tr ID="itemPlaceholder" runat="server">

</tr>

</table>

</td>

</tr>

<tr id="Tr3" runat="server">

<td id="Td2" runat="server" style="">

<asp:DataPager ID="DataPager1" runat="server">

<Fields>

<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True"

ShowLastPageButton="True" />

</Fields>

</asp:DataPager>

</td>

</tr>

</table>

</LayoutTemplate>

<ItemTemplate>

<tr runat="server" style="">

<td>

<asp:Button ID="DeleteButton" runat="server" CommandName="Delete"

Text="Delete" />

<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />

</td>

<td>

<asp:Label ID="CustomerIdLabel" runat="server"

Text=’<%# Eval("CustomerId") %> />

</td>

<td>

<asp:Label ID="NameLabel" runat="server" Text=’<%# Eval("Name") %> />

</td>

<td>

<asp:Label ID="ManufactureLabel" runat="server"

Text=’<%# Eval("Manufacture") %> />

</td>

<td>

<asp:Label ID="ModelLabel" runat="server" Text=’<%# Eval("Model") %> />

</td>

</tr>

</ItemTemplate>

<InsertItemTemplate>

<tr runat="server" style="">

<td>

<asp:Button ID="InsertButton" runat="server" CommandName="Insert"

Text="Insert" />

<asp:Button ID="CancelButton" runat="server" CommandName="Cancel"

Text="Clear" />

</td>

<td></td>

<td>

<asp:TextBox ID="NameTextBox" runat="server" Text=’<%# Bind("Name") %> />

</td>

<td>

<asp:DropDownList ID="ddlManufacture" runat="server" AutoPostBack="True" DataTextField="Manufacture"

DataValueField="Manufacture" Width="122px" DataSourceID="dsManufactures" AppendDataBoundItems="true" >

<asp:ListItem>Please select</asp:ListItem>

</asp:DropDownList>

<asp:SqlDataSource ID="dsManufactures" runat="server" ConnectionString="<%$ ConnectionStrings:test_for_forumConnectionString %>"

SelectCommand="SELECT [Manufacture] FROM [Manufactures]" ></asp:SqlDataSource>

</td>

<td>

<asp:DropDownList ID="ddlModel" runat="server" DataSourceID="dsModels"

DataTextField="Model" DataValueField="Model" >

</asp:DropDownList>

<br />

<asp:SqlDataSource ID="dsModels" runat="server" ConnectionString="<%$ ConnectionStrings:test_for_forumConnectionString %>"

SelectCommand="SELECT * FROM [Models] where Manufacture =@Manufacture">

<SelectParameters>

<asp:ControlParameter ControlID="ddlManufacture" Name="Manufacture" />

</SelectParameters>

</asp:SqlDataSource>

</td>

</tr>

</InsertItemTemplate>

<SelectedItemTemplate>

<tr runat="server" style="">

<td>

<asp:Button ID="DeleteButton" runat="server" CommandName="Delete"

Text="Delete" />

<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />

</td>

<td>

<asp:Label ID="CustomerIdLabel" runat="server"

Text=’<%# Eval("CustomerId") %> />

</td>

<td>

<asp:Label ID="NameLabel" runat="server" Text=’<%# Eval("Name") %> />

</td>

<td>

<asp:Label ID="ManufactureLabel" runat="server"

Text=’<%# Eval("Manufacture") %> />

</td>

<td>

<asp:Label ID="ModelLabel" runat="server" Text=’<%# Eval("Model") %> />

</td>

</tr>

</SelectedItemTemplate>

<EmptyDataTemplate>

<table runat="server" style="">

<tr>

<td>

No data was returned.

</td>

</tr>

</table>

</EmptyDataTemplate>

<EditItemTemplate>

<tr runat="server" style="">

<td>

<asp:Button ID="UpdateButton" runat="server" CommandName="Update"

Text="Update" />

<asp:Button ID="CancelButton" runat="server" CommandName="Cancel"

Text="Cancel" />

</td>

<td>

<asp:Label ID="CustomerIdLabel1" runat="server"

Text=’<%# Eval("CustomerId") %> />

</td>

<td>

<asp:TextBox ID="NameTextBox" runat="server" Text=’<%# Bind("Name") %> />

</td>

<td>

<asp:DropDownList ID="ddlManufacture" runat="server" AutoPostBack="True" DataTextField="Manufacture"

DataValueField="Manufacture" Width="122px" SelectedValue=’<%# Bind("Manufacture") %>

DataSourceID="dsManufactures" >

</asp:DropDownList>

<asp:SqlDataSource ID="dsManufactures" runat="server" ConnectionString="<%$ ConnectionStrings:test_for_forumConnectionString %>"

SelectCommand="SELECT [Manufacture] FROM [Manufactures]" ></asp:SqlDataSource>

</td>

<td> <asp:Label ID="ModelLabel" runat="server" Text=’<%# Eval("Model") %> Visible="false" />

<asp:DropDownList ID="ddlModel" runat="server" DataSourceID="dsModels"

DataTextField="Model" DataValueField="Model" OnDataBound="ddlModel_DataBound" >

</asp:DropDownList>

<br />

<asp:SqlDataSource ID="dsModels" runat="server" ConnectionString="<%$ ConnectionStrings:test_for_forumConnectionString %>"

SelectCommand="SELECT * FROM [Models] where Manufacture =@Manufacture">

<SelectParameters>

<asp:ControlParameter ControlID="ddlManufacture" Name="Manufacture" />

</SelectParameters>

</asp:SqlDataSource>

</td>

</tr>

</EditItemTemplate>

</asp:ListView>

<asp:SqlDataSource ID="SqlDataSource1" runat="server"

ConnectionString="<%$ ConnectionStrings:test_for_forumConnectionString %>"

DeleteCommand="DELETE FROM [AutoCustomers] WHERE [CustomerId] = @CustomerId"

InsertCommand="INSERT INTO [AutoCustomers] ([Name], [Manufacture], [Model]) VALUES (@Name, @Manufacture, @Model)"

SelectCommand="SELECT [CustomerId], [Name], [Manufacture], [Model] FROM [AutoCustomers]"

UpdateCommand="UPDATE [AutoCustomers] SET [Name] = @Name, [Manufacture] = @Manufacture, [Model] = @Model WHERE [CustomerId] = @CustomerId">

<%

— <DeleteParameters>

<asp:parameter Name="CustomerId" Type="Int32" />

</DeleteParameters>

<UpdateParameters>

<asp:parameter Name="Name" Type="String" />

<asp:parameter Name="Manufacture" Type="String" />

<asp:parameter Name="Model" Type="String" />

<asp:parameter Name="CustomerId" Type="Int32" />

</UpdateParameters>

<InsertParameters>

<asp:parameter Name="Name" Type="String" />

<asp:parameter Name="Manufacture" Type="String" />

<asp:parameter Name="Model" Type="String" />

</InsertParameters>–

%>

</asp:SqlDataSource>

C# code:

protected

void ddlModel_DataBound(object sender, EventArgs e)

{

DropDownList ddlModel = (DropDownList)sender;

ListViewItem ListViewItem1 = (ListViewItem)ddlModel.NamingContainer;

if (ListViewItem1 != null)

{

Label lblModel = (Label)ListViewItem1.FindControl("ModelLabel");

string strModel = lblModel.Text;

ListItem lm = ddlModel.Items.FindByValue(strModel);

if (lm != null) lm.Selected = true;

}

}

protected void ListView1_ItemUpdating(object sender, ListViewUpdateEventArgs e)

{

ListViewItem item = ListView1.Items[e.ItemIndex];

string strName = ((TextBox)item.FindControl("NameTextBox")).Text;

string strModel = ((DropDownList)item.FindControl("ddlModel")).SelectedValue;

string strManufacturer = ((DropDownList)item.FindControl("ddlManufacture")).SelectedValue;

e.NewValues["Name"] = strName;

e.NewValues[

"Model"] = strModel;

e.NewValues["Manufacture"] = strManufacturer;

e.Cancel = false;

}

protected void ListView1_OnItemInserting(object sender, ListViewInsertEventArgs e)

{

string strName=((TextBox)e.Item.FindControl("NameTextBox")).Text;

string strModel = ((DropDownList)e.Item.FindControl("ddlModel")).SelectedValue;

string strManufacture = ((DropDownList)e.Item.FindControl("ddlManufacture")).SelectedValue;

e.Values[

"Name"] = strName;

e.Values[

"Model"] = strModel;

e.Values[

"Manufacture"] = strManufacture;

e.Cancel =

false;

}