473,378 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

very strange problem

Hi,

When I place the following coede in Page_Load method it doesn't populate the
DropDownList and when I place it in Button1_Click method and I push the
button after the page is loaded the DropDownList is populated. What I should
do in order to populate the DropDownList when I reach this WebForm by link
from another WebForm?
SqlConnection conn = new SqlConnection("Data Source=BLEK;Initial
Catalog=Estate; User ID=blek; Password=banderas");

SqlDataAdapter dad = new SqlDataAdapter ("SELECT
blek.TypeOffer.OfferID,blek.TypeOffer.TypeOffer FROM blek.TypeOffer", conn);

conn.Open();

dad.SelectCommand.ExecuteNonQuery();

DataTable table=new DataTable();

dad.Fill(table);

DropDownList2.DataSource=table;

DropDownList2.DataValueField = "OfferID";

DropDownList2.DataTextField = "TypeOffer";

DropDownList2.DataBind();

msg.Text = table.Rows.Count.ToString();

conn.Close();
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.729 / Virus Database: 484 - Release Date: 27.7.2004 a.

Nov 18 '05 #1
5 1312
Maybe Page_Load method is not wired to the Load event to be its handler.

"Viktor Popov" <vi****@yahoo.com> wrote in message
news:eD**************@TK2MSFTNGP10.phx.gbl...
Hi,

When I place the following coede in Page_Load method it doesn't populate the DropDownList and when I place it in Button1_Click method and I push the
button after the page is loaded the DropDownList is populated. What I should do in order to populate the DropDownList when I reach this WebForm by link
from another WebForm?
SqlConnection conn = new SqlConnection("Data Source=BLEK;Initial
Catalog=Estate; User ID=blek; Password=banderas");

SqlDataAdapter dad = new SqlDataAdapter ("SELECT
blek.TypeOffer.OfferID,blek.TypeOffer.TypeOffer FROM blek.TypeOffer", conn);
conn.Open();

dad.SelectCommand.ExecuteNonQuery();

DataTable table=new DataTable();

dad.Fill(table);

DropDownList2.DataSource=table;

DropDownList2.DataValueField = "OfferID";

DropDownList2.DataTextField = "TypeOffer";

DropDownList2.DataBind();

msg.Text = table.Rows.Count.ToString();

conn.Close();
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.729 / Virus Database: 484 - Release Date: 27.7.2004 a.

Nov 18 '05 #2
are you checking for page.ispostback in your pageload?

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"Viktor Popov" <vi****@yahoo.com> wrote in message
news:eD**************@TK2MSFTNGP10.phx.gbl...
Hi,

When I place the following coede in Page_Load method it doesn't populate
the
DropDownList and when I place it in Button1_Click method and I push the
button after the page is loaded the DropDownList is populated. What I
should
do in order to populate the DropDownList when I reach this WebForm by link
from another WebForm?
SqlConnection conn = new SqlConnection("Data Source=BLEK;Initial
Catalog=Estate; User ID=blek; Password=banderas");

SqlDataAdapter dad = new SqlDataAdapter ("SELECT
blek.TypeOffer.OfferID,blek.TypeOffer.TypeOffer FROM blek.TypeOffer",
conn);

conn.Open();

dad.SelectCommand.ExecuteNonQuery();

DataTable table=new DataTable();

dad.Fill(table);

DropDownList2.DataSource=table;

DropDownList2.DataValueField = "OfferID";

DropDownList2.DataTextField = "TypeOffer";

DropDownList2.DataBind();

msg.Text = table.Rows.Count.ToString();

conn.Close();
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.729 / Virus Database: 484 - Release Date: 27.7.2004 a.

Nov 18 '05 #3
Thanks for the reply!
How could I check that or to wired the Page_Load to the Load event ?

"Marina" <so*****@nospam.com> wrote in message
news:#x**************@TK2MSFTNGP10.phx.gbl...
Maybe Page_Load method is not wired to the Load event to be its handler.

"Viktor Popov" <vi****@yahoo.com> wrote in message
news:eD**************@TK2MSFTNGP10.phx.gbl...
Hi,

When I place the following coede in Page_Load method it doesn't populate

the
DropDownList and when I place it in Button1_Click method and I push the
button after the page is loaded the DropDownList is populated. What I

should
do in order to populate the DropDownList when I reach this WebForm by link from another WebForm?
SqlConnection conn = new SqlConnection("Data Source=BLEK;Initial
Catalog=Estate; User ID=blek; Password=banderas");

SqlDataAdapter dad = new SqlDataAdapter ("SELECT
blek.TypeOffer.OfferID,blek.TypeOffer.TypeOffer FROM blek.TypeOffer",

conn);

conn.Open();

dad.SelectCommand.ExecuteNonQuery();

DataTable table=new DataTable();

dad.Fill(table);

DropDownList2.DataSource=table;

DropDownList2.DataValueField = "OfferID";

DropDownList2.DataTextField = "TypeOffer";

DropDownList2.DataBind();

msg.Text = table.Rows.Count.ToString();

conn.Close();
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.729 / Virus Database: 484 - Release Date: 27.7.2004 a.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.729 / Virus Database: 484 - Release Date: 27.7.2004 a.
Nov 18 '05 #4
Thanks for the reply
Yes, I use if (!Page.IsPostBack)
{
code
}

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:Oa**************@TK2MSFTNGP12.phx.gbl...
are you checking for page.ispostback in your pageload?

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"Viktor Popov" <vi****@yahoo.com> wrote in message
news:eD**************@TK2MSFTNGP10.phx.gbl...
Hi,

When I place the following coede in Page_Load method it doesn't populate
the
DropDownList and when I place it in Button1_Click method and I push the
button after the page is loaded the DropDownList is populated. What I
should
do in order to populate the DropDownList when I reach this WebForm by link from another WebForm?
SqlConnection conn = new SqlConnection("Data Source=BLEK;Initial
Catalog=Estate; User ID=blek; Password=banderas");

SqlDataAdapter dad = new SqlDataAdapter ("SELECT
blek.TypeOffer.OfferID,blek.TypeOffer.TypeOffer FROM blek.TypeOffer",
conn);

conn.Open();

dad.SelectCommand.ExecuteNonQuery();

DataTable table=new DataTable();

dad.Fill(table);

DropDownList2.DataSource=table;

DropDownList2.DataValueField = "OfferID";

DropDownList2.DataTextField = "TypeOffer";

DropDownList2.DataBind();

msg.Text = table.Rows.Count.ToString();

conn.Close();
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.729 / Virus Database: 484 - Release Date: 27.7.2004 a.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.729 / Virus Database: 484 - Release Date: 27.7.2004 a.
Nov 18 '05 #5
I have done it:)
Thanks!
"Viktor Popov" <vi****@yahoo.com> wrote in message
news:eD**************@TK2MSFTNGP10.phx.gbl...
Hi,

When I place the following coede in Page_Load method it doesn't populate the DropDownList and when I place it in Button1_Click method and I push the
button after the page is loaded the DropDownList is populated. What I should do in order to populate the DropDownList when I reach this WebForm by link
from another WebForm?
SqlConnection conn = new SqlConnection("Data Source=BLEK;Initial
Catalog=Estate; User ID=blek; Password=banderas");

SqlDataAdapter dad = new SqlDataAdapter ("SELECT
blek.TypeOffer.OfferID,blek.TypeOffer.TypeOffer FROM blek.TypeOffer", conn);
conn.Open();

dad.SelectCommand.ExecuteNonQuery();

DataTable table=new DataTable();

dad.Fill(table);

DropDownList2.DataSource=table;

DropDownList2.DataValueField = "OfferID";

DropDownList2.DataTextField = "TypeOffer";

DropDownList2.DataBind();

msg.Text = table.Rows.Count.ToString();

conn.Close();
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.729 / Virus Database: 484 - Release Date: 27.7.2004 a.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.729 / Virus Database: 484 - Release Date: 27.7.2004 a.
Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Google Mike | last post by:
I have RH9 and am using the PHP and MySQL that came with it. I was doing fine with all manner of my web pages for this app until I started having this very strange problem. It's a work order...
6
by: leonecla | last post by:
Hi everybody, I'm facing a very very strange problem with a very very simple C program... My goal should be to write to a binary file some numbers (integers), each one represented as a sequence...
2
by: TB | last post by:
I am seeing a very strange problem as follows... I have a loop where a fair amount of processing is going on and near the top of the loop I access a class that has only static helper functions...
5
by: cody | last post by:
I have a very funny/strange effect here. if I let the delegate do "return prop.GetGetMethod().Invoke(info.AudioHeader, null);" then I get wrong results, that is, a wrong method is called and I...
3
by: Trapulo | last post by:
I've two copy af the same asp.net application. The application enter on sql server, working with two separate databases (on the same sql server instance, of course). The connection is made with...
2
by: Buddy Ackerman | last post by:
I have a web app that I have setup on numerous web servers. I've set one up for a new client at their hosting facility and cannot get it to connect to their database. I get a "SQL Server does not...
6
by: Chris Ashley | last post by:
I have been tearing my hair out (or indeed, what's left of it) all day with this one. I'm not sure if it's a .NET issue, a server issue or anything else and would appreciate any guidance. ...
12
by: John | last post by:
I can't get my head around this! I have the following code: <% .... Code for connection to the database ... .... Code for retrieving recordset ... If Not rs.EOF Then ... Do something...
112
by: Prisoner at War | last post by:
Friends, your opinions and advice, please: I have a very simple JavaScript image-swap which works on my end but when uploaded to my host at http://buildit.sitesell.com/sunnyside.html does not...
126
by: jacob navia | last post by:
Buffer overflows are a fact of life, and, more specifically, a fact of C. All is not lost however. In the book "Value Range Analysis of C programs" Axel Simon tries to establish a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.