Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > SqlDataSource, GridView

Reply
Thread Tools

SqlDataSource, GridView

 
 
zp
Guest
Posts: n/a
 
      03-11-2007
Hi there,
Have a web page with SqlDataSource and GridView (.NET 2) that gets and
displays data from database. The connection to the database is opened on page
load and the grid is populated. I have no problem at all on my testing
machine, IIS5 or VS development server, but when I deploy it on a remote
server (win2003, IIS6) and the page is displayed the data not showing in the
grid all the time. Some times I have to click several times back and forth in
order the grid to be populated with data. This is the code I use on page load
event:

protected void Page_Load(object sender, EventArgs e)
{
try
{
string LClassTutor;
LClassTutor = (String)Session["UserId"];
Parameter Parameter1 = new Parameter();
Parameter1.Name = "@CR";
Parameter1.Type = TypeCode.String;
Parameter1.DefaultValue = LClassTutor;
DsStdOnClass.SelectParameters.Add(Parameter1);
GvStudents.DataBind();

}
catch
{
Session["ERROR"] = "Parameters definition";
Server.Transfer("Error.aspx", true);
}
}

Have tried many variation of the above code but the problem persists. Any
suggestion where to look for possible solution?

Thanks
zp

 
Reply With Quote
 
 
 
 
zp
Guest
Posts: n/a
 
      03-12-2007
Answering my own question. The problem was in the lost session value. I've
used a session to store the user login info, which was used as a parameter
(@CR) in the query. The IIS6 kills the session for some reasons, and the
value is reset, so my user id was lost, and the query failed. I've decided to
use Cookies to store the value of the user id and all is working fine now.
--
zp


"zp" wrote:

> Hi there,
> Have a web page with SqlDataSource and GridView (.NET 2) that gets and
> displays data from database. The connection to the database is opened on page
> load and the grid is populated. I have no problem at all on my testing
> machine, IIS5 or VS development server, but when I deploy it on a remote
> server (win2003, IIS6) and the page is displayed the data not showing in the
> grid all the time. Some times I have to click several times back and forth in
> order the grid to be populated with data. This is the code I use on page load
> event:
>
> protected void Page_Load(object sender, EventArgs e)
> {
> try
> {
> string LClassTutor;
> LClassTutor = (String)Session["UserId"];
> Parameter Parameter1 = new Parameter();
> Parameter1.Name = "@CR";
> Parameter1.Type = TypeCode.String;
> Parameter1.DefaultValue = LClassTutor;
> DsStdOnClass.SelectParameters.Add(Parameter1);
> GvStudents.DataBind();
>
> }
> catch
> {
> Session["ERROR"] = "Parameters definition";
> Server.Transfer("Error.aspx", true);
> }
> }
>
> Have tried many variation of the above code but the problem persists. Any
> suggestion where to look for possible solution?
>
> Thanks
> zp
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView Hierarchical View - Gridview in Gridview =?Utf-8?B?bWdvbnphbGVzMw==?= ASP .Net 1 05-09-2006 06:48 PM
Gridview inside Gridview little problems... Carlos Albert ASP .Net 1 12-06-2005 05:31 PM
GridView in a GridView Carlos Albert ASP .Net 2 12-06-2005 12:42 PM
GridView in a GridView Nalaka ASP .Net 6 12-05-2005 05:48 PM
Gridview with combobox whose data is dependent on field in gridview wallermj@hotmail.com ASP .Net 3 11-21-2005 05:34 PM



Advertisments