ComboBoxXmlDataSource.aspx
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Ajax ComboBox - How to populate ComboBox from XmlDataSource in asp.net</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:DarkBlue; font-style:italic;">
ASP.NET Ajax ComboBox - How to populate ComboBox
<br /> from XmlDataSource programmatically in asp.net
</h2>
<hr width="525" align="left" color="LightBlue" />
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<br /><br />
<asp:ComboBox
ID="ComboBox1"
runat="server"
DropDownStyle="DropDown"
DataSourceID="XmlDataSource1"
DataTextField="Name"
DataValueField="ID"
AutoCompleteMode="None"
CaseSensitive="false"
RenderMode="Block"
AppendDataBoundItems="true"
AutoPostBack="false"
Font-Names="Comic Sans MS"
Font-Size="Medium"
ForeColor="Green"
>
</asp:ComboBox>
<asp:XmlDataSource ID="XmlDataSource1" runat="server">
<Data>
<Colors>
<Color ID="1" Name="Crimson" />
<Color ID="2" Name="CornFlowerBlue" />
<Color ID="3" Name="BlanchedAlmond" />
<Color ID="4" Name="IndianRed" />
<Color ID="5" Name="Coral" />
</Colors>
</Data>
</asp:XmlDataSource>
</div>
</form>
</body>
</html>
No comments:
Post a Comment