Thursday, 18 July 2013
Display combobox values from database
hi friends in this section i cover read data from database and display it on combobox using ext.net.
if you dont know session statement read our session tuts.
The procedure shown in the below ie.
first insert combobox and SqlDataSource into the project
id-integer type
name-varchar(50)
if you dont know session statement read our session tuts.
The procedure shown in the below ie.
first insert combobox and SqlDataSource into the project
<form id="form1" runat="server">
<div>
<ext:ComboBox ID="dreamtheweb" runat="server" AnchorHorizontal="100%" DisplayField="name"
ValueField="id" FieldLabel="Country">
<Store>
<ext:Store ID="sestore1" runat="server" DataSourceID="SqlDataSource1">
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="id" />
<ext:ModelField Name="name">
</ext:ModelField>
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
</ext:ComboBox>
</div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:testing %>"
SelectCommand="SELECT * FROM [country] ">
</asp:SqlDataSource>
</form>
Insert connection string testing in web.config file<div>
<ext:ComboBox ID="dreamtheweb" runat="server" AnchorHorizontal="100%" DisplayField="name"
ValueField="id" FieldLabel="Country">
<Store>
<ext:Store ID="sestore1" runat="server" DataSourceID="SqlDataSource1">
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="id" />
<ext:ModelField Name="name">
</ext:ModelField>
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
</ext:ComboBox>
</div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:testing %>"
SelectCommand="SELECT * FROM [country] ">
</asp:SqlDataSource>
</form>
<connectionStrings>
<add name="testing" connectionString="Data Source=jishnu\sqlexpress;Initial Catalog=gatikktechno;Integrated Security=True;Pooling=False"/>
</connectionStrings>
Database definition<add name="testing" connectionString="Data Source=jishnu\sqlexpress;Initial Catalog=gatikktechno;Integrated Security=True;Pooling=False"/>
</connectionStrings>
id-integer type
name-varchar(50)
0 comments:
Post a Comment