spudmasher
07-27-2005, 08:11 PM
this may be the wrong forum for this, but it does relate solely to ASP.NET.
I'm still a bit green around the whole area of ASP.NET but learning fast. However, I'm not 100% sure whether I'm going about certain things the right way.
For example, I have an application that takes information from one form and passes it to another for data entry. Theres a lot of datagrid controls with template columns. the template columns are dropdown list boxes. All the information is coming from SQL Server.
For each DDL and other controls, i'm pulling the info from stored procedures or straight up SQL, for example
sqlAdapter = New SqlClient.SqlDataAdapter("select * from tblTableExample", sqlConnection)
sqlAdapter.SelectCommand.CommandType = CommandType.Text
sqlAdapter.SelectCommand.ExecuteReader()
ds = New DataSet
sqlConnection.Close()
sqlAdapter.Fill(ds)
ddlTableExample.DataSource = ds
ddlTableExample.DataBind()
Of course on each postback, this code is re-executed. I'm using the smart navigation to retain the position on the page, though the flicker still happens (probably due to the amount of calls to SQL server)
Is there a better way of doing this? Should I be storing the datasets first time round in Session variables and retrieving the information from here upon postbacks? Is there a good way to populate multiple DDL's (and other controls) from SQL Server?
Just looking for some advice and guidance here.
Thanking you in advance.
I'm still a bit green around the whole area of ASP.NET but learning fast. However, I'm not 100% sure whether I'm going about certain things the right way.
For example, I have an application that takes information from one form and passes it to another for data entry. Theres a lot of datagrid controls with template columns. the template columns are dropdown list boxes. All the information is coming from SQL Server.
For each DDL and other controls, i'm pulling the info from stored procedures or straight up SQL, for example
sqlAdapter = New SqlClient.SqlDataAdapter("select * from tblTableExample", sqlConnection)
sqlAdapter.SelectCommand.CommandType = CommandType.Text
sqlAdapter.SelectCommand.ExecuteReader()
ds = New DataSet
sqlConnection.Close()
sqlAdapter.Fill(ds)
ddlTableExample.DataSource = ds
ddlTableExample.DataBind()
Of course on each postback, this code is re-executed. I'm using the smart navigation to retain the position on the page, though the flicker still happens (probably due to the amount of calls to SQL server)
Is there a better way of doing this? Should I be storing the datasets first time round in Session variables and retrieving the information from here upon postbacks? Is there a good way to populate multiple DDL's (and other controls) from SQL Server?
Just looking for some advice and guidance here.
Thanking you in advance.