| | |
DropdownList DataBinding
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Mar 2008
Posts: 324
Reputation:
Solved Threads: 7
ASP.NET Syntax (Toggle Plain Text)
<connectionStrings> <add name="ConnectionString" connectionString="Data Source=(local);Initial catalog=sonia;User ID=sonia;Password=sonia;" providerName="System.Data.SqlClient"/> </connectionStrings>
ASP.NET Syntax (Toggle Plain Text)
public partial class Frmgrid : System.Web.UI.Page { SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); SqlDataAdapter da; DataSet ds; protected void Page_Load(object sender, EventArgs e) { try { da = new SqlDataAdapter("SELECT * FROM Products", conn); da.Fill(ds, "tb1"); DropDownList1.DataSource = ds.Tables["tb1"]; DropDownList1.DataBind(); } catch (Exception ex) { Response.Write(ex.Message.ToString()); } } }
ERROR is dere while executing the line da.Fill(ds, "tb1");
"Value cannot be null.\r\nParameter name: dataSet"
Last edited by sonia sardana; Oct 23rd, 2009 at 1:40 pm.
•
•
Join Date: Jul 2008
Posts: 44
Reputation:
Solved Threads: 6
0
#2 Oct 23rd, 2009
You must intialize ds
e.g. DataSet ds = new DataSet();
Check this eg:
http://msdn.microsoft.com/en-us/libr...8z(VS.80).aspx
e.g. DataSet ds = new DataSet();
Check this eg:
http://msdn.microsoft.com/en-us/libr...8z(VS.80).aspx
![]() |
Similar Threads
- Fill Drodownlist By changing value in another dropdownlist (ASP.NET)
- GetSelectedIndex Datagrid? Dropdownlist (ASP.NET)
- DropDownList headache (ASP.NET)
- Help with Databinding (ASP.NET)
- DataGrid: Edit mode, the index of a dropdownlist does not start at the right Value (ASP.NET)
- GetSelectedIndex Datagrid? Dropdownlist (C#)
- How do I save an index to a particular index of a dropdownlist in a datagrid. (C#)
- Help With Datagrid RE: Creating and Saving DropDownList ReportsToID (C#)
Other Threads in the ASP.NET Forum
- Previous Thread: Problem With Dropdowns, Loops, Databinding and Placeholders
- Next Thread: Inserting .swf file
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 3.5 activexcontrol advice ajax alltypeofvideos anathor asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox child click commonfunctions compatible confirmationcodegeneration content contenttype courier css database datagrid datagridview datagridviewcheckbox datalist deadlock development dgv dropdown dropdownlist dropdownmenu edit expose feedback flash flv folder form formatdecimal forms formview google grid gridview homeedition hosting iframe iis javascript jquery list login menu microsoft mono mssql multistepregistration nameisnotdeclared numerical objects order panelmasterpagebuttoncontrols project ratings refer rotatepage save schoolproject search security serializesmo.table silverlight smartcard sqlserver2005 suse textbox tracking typeof unauthorized validation vb.net video view virtualdirectory vista visual-studio visualstudio web webarchitecture webdevelopemnt webservice xml youareanotmemberofthedebuggerusers





