ComboBoxArray.aspx
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
string[] Colors = {"BurlyWood","Chartreuse","Salmon","Ivory","Magenta"};
ComboBox1.DataSource = Colors;
ComboBox1.DataBind();
}
</script>
<head id="Head1" runat="server">
<title>Ajax ComboBox - How to populate ComboBox from an array 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
<br /> ComboBox from an array in asp.net
</h2>
<hr width="475" align="left" color="Pink" />
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:ComboBox
ID="ComboBox1"
runat="server"
DropDownStyle="DropDown"
AutoCompleteMode="None"
CaseSensitive="false"
RenderMode="Block"
AutoPostBack="false"
Font-Names="Comic Sans MS"
Font-Size="Large"
ForeColor="SeaGreen"
>
</asp:ComboBox>
<br /><br /><br />
<br /><br /><br />
<asp:Button
ID="Button1"
runat="server"
OnClick="Button1_Click"
Text="Populate ComboBox From Array"
Height="45"
Font-Bold="true"
ForeColor="DodgerBlue"
/>
</div>
</form>
</body>
</html>
No comments:
Post a Comment