473,811 Members | 2,981 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I keep the dropdownlist from populating my gridview?

I have a gridview and a dropdownlist. If I change the ddl, the
gridview populates. That is what I want. But what I don't want is for
it to happen the first time they get to the page. I know I can add a
"Select Item," but is that the correct way to do it? I don't want it
to hit the database at all the first time the page loads. I have done
everything through visual studio and was trying to see if I could do
this with no code behind. Thanks.

Sep 10 '06 #1
6 1482
You need to check page property IsPostBack.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
<ne***********@ gmail.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
>I have a gridview and a dropdownlist. If I change the ddl, the
gridview populates. That is what I want. But what I don't want is for
it to happen the first time they get to the page. I know I can add a
"Select Item," but is that the correct way to do it? I don't want it
to hit the database at all the first time the page loads. I have done
everything through visual studio and was trying to see if I could do
this with no code behind. Thanks.

Sep 10 '06 #2
So I cannot do this solely using the GUI? I will have to code it in
the page_load? Thanks.
Eliyahu Goldin wrote:
You need to check page property IsPostBack.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
<ne***********@ gmail.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
I have a gridview and a dropdownlist. If I change the ddl, the
gridview populates. That is what I want. But what I don't want is for
it to happen the first time they get to the page. I know I can add a
"Select Item," but is that the correct way to do it? I don't want it
to hit the database at all the first time the page loads. I have done
everything through visual studio and was trying to see if I could do
this with no code behind. Thanks.
Sep 12 '06 #3
Yes.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
<ne***********@ gmail.comwrote in message
news:11******** *************@m 73g2000cwd.goog legroups.com...
So I cannot do this solely using the GUI? I will have to code it in
the page_load? Thanks.
Eliyahu Goldin wrote:
>You need to check page property IsPostBack.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
<ne*********** @gmail.comwrote in message
news:11******* *************** @b28g2000cwb.go oglegroups.com. ..
>I have a gridview and a dropdownlist. If I change the ddl, the
gridview populates. That is what I want. But what I don't want is for
it to happen the first time they get to the page. I know I can add a
"Select Item," but is that the correct way to do it? I don't want it
to hit the database at all the first time the page loads. I have done
everything through visual studio and was trying to see if I could do
this with no code behind. Thanks.

Sep 12 '06 #4
Here's my problem. Since I put everything in the front I'm not sure
what to put in the page behind. It's got the objectdatasourc e control
in the "regular" .aspx page.

How can I tell the grid not to fire if all the "stuff" is in the .aspx
file?
Eliyahu Goldin wrote:
Yes.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
<ne***********@ gmail.comwrote in message
news:11******** *************@m 73g2000cwd.goog legroups.com...
So I cannot do this solely using the GUI? I will have to code it in
the page_load? Thanks.
Eliyahu Goldin wrote:
You need to check page property IsPostBack.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
<ne***********@ gmail.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
I have a gridview and a dropdownlist. If I change the ddl, the
gridview populates. That is what I want. But what I don't want is for
it to happen the first time they get to the page. I know I can add a
"Select Item," but is that the correct way to do it? I don't want it
to hit the database at all the first time the page loads. I have done
everything through visual studio and was trying to see if I could do
this with no code behind. Thanks.
Sep 12 '06 #5
Are you asking how to add some code to an aspx page? You can add a
service-side script to the aspx page. Would you call it "in the front"? You
can't use asp.net without writing a line of code. This is a sort of
professional technology, it needs a professional approach.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
<ne***********@ gmail.comwrote in message
news:11******** **************@ i3g2000cwc.goog legroups.com...
Here's my problem. Since I put everything in the front I'm not sure
what to put in the page behind. It's got the objectdatasourc e control
in the "regular" .aspx page.

How can I tell the grid not to fire if all the "stuff" is in the .aspx
file?
Eliyahu Goldin wrote:
>Yes.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
<ne*********** @gmail.comwrote in message
news:11******* **************@ m73g2000cwd.goo glegroups.com.. .
So I cannot do this solely using the GUI? I will have to code it in
the page_load? Thanks.
Eliyahu Goldin wrote:
You need to check page property IsPostBack.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
<ne*********** @gmail.comwrote in message
news:11******* *************** @b28g2000cwb.go oglegroups.com. ..
I have a gridview and a dropdownlist. If I change the ddl, the
gridview populates. That is what I want. But what I don't want is
for
it to happen the first time they get to the page. I know I can add
a
"Select Item," but is that the correct way to do it? I don't want
it
to hit the database at all the first time the page loads. I have
done
everything through visual studio and was trying to see if I could do
this with no code behind. Thanks.


Sep 12 '06 #6
No, I guess I wasn't clear. Sorry. I don't mind coding. I shouldn't
have to in this case, at least I thought.

I ended up being right and half right to begin with. I added an item
to my dropdownlist (-- select item --) and then set the value to -1, as
there is no -1 in my database. I then set the AppendDataBound Items
setting in the dropdownlist to true so that the new --select item--
wouldn't be lost when the dropdownlist was populated by items from the
database. No coding beyond the .aspx page necessary.

Eliyahu Goldin wrote:
Are you asking how to add some code to an aspx page? You can add a
service-side script to the aspx page. Would you call it "in the front"? You
can't use asp.net without writing a line of code. This is a sort of
professional technology, it needs a professional approach.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
<ne***********@ gmail.comwrote in message
news:11******** **************@ i3g2000cwc.goog legroups.com...
Here's my problem. Since I put everything in the front I'm not sure
what to put in the page behind. It's got the objectdatasourc e control
in the "regular" .aspx page.

How can I tell the grid not to fire if all the "stuff" is in the .aspx
file?
Eliyahu Goldin wrote:
Yes.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
<ne***********@ gmail.comwrote in message
news:11******** *************@m 73g2000cwd.goog legroups.com...
So I cannot do this solely using the GUI? I will have to code it in
the page_load? Thanks.
Eliyahu Goldin wrote:
You need to check page property IsPostBack.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
<ne***********@ gmail.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
I have a gridview and a dropdownlist. If I change the ddl, the
gridview populates. That is what I want. But what I don't want is
for
it to happen the first time they get to the page. I know I can add
a
"Select Item," but is that the correct way to do it? I don't want
it
to hit the database at all the first time the page loads. I have
done
everything through visual studio and was trying to see if I could do
this with no code behind. Thanks.
Sep 13 '06 #7

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

Similar topics

1
1408
by: bill tie | last post by:
I have two dropDownLists A and B outside a gridView. A selection made in ddlA causes ddlB to be populated with data from the database. The gridView is populated with data according to a selection in ddlB. ddlA --> ddlB --> gridView When a user selects an item in ddlA, I want (a) the ddlB to be populated automatically
2
2341
by: Phil Sandler | last post by:
I am trying to do something which seems (to me) to be very simple, and yet I can't seem to figure it out. I have a gridview and a formview. When a user clicks "select" in the gridview, the formview opens. The user can then click "insert" or "update" to either create a new row or edit the existing row. This all works fine as long as I only use textboxes and checkboxes in my insertItemTemplate and editItemTemplate. What I would like...
0
5963
by: sgtmarcjones | last post by:
How do I access a dropdownlist that is nested within a Formview ItemTemplate Gridview Template? I want to see a label (lgbTimeKeep ! TextValue of ddlName dropdownlist) instead of a dropdownlist in the FormView ItemTemplate Nested Gridview ddlName ItemTemplate. My label is named lgvTimeKeep and the dropdownlist name is ddlName. Thanks!
0
1707
by: koonda | last post by:
Hi all, I have a Project due after one week. It is a web service project. I have a Web Form which communicates to the web service and this web service communicates to the database. I have all my SQL statements in the Data Acess Layer to create more secure web service application. The Web service class is also in the Data Access Layer. I need to populates the 4 Dropdown list boxes on the web form from one table. I have Customer table which...
3
13983
by: Brian VanDyke | last post by:
I have to display a table with customer data (GridView). However, I want to be able to show DropDownList controls inside one of the columns, not just textbox controls. Is this possible? Is it possible to have all of the controls active so that a simple click of the Submit button updates all customer records with the data in those DropDownLists? I was able to do this with classic ASP, but with a GridView control (perhaps I need a...
0
2228
by: lamolap | last post by:
i have 1 gridview , a dropdownlist inside a gridview and a commandfield of (edit, update and cancel) my gidview looks like this Edit Surname Initials ParkingBay CommandField Me Y dropdownlistvalue CommandField You m dropdownlistvalue i have 2 sqldatasource. the other one is for gridview and...
0
1893
by: Fabrizio | last post by:
Hi all. I have a field in a gridview as templatefield which is a label in view mode and a dropdownlist in edit mode with his datasource. This gridview is inserted as templatefield in another mother gridview. GRIDVIEW1 - GRIDVIEW2
2
1297
by: RobertTheProgrammer | last post by:
Hi again, Okay, I decided the GridView is the way to go to solve my problem. But now I've got another problem. I've found plenty of examples about how to add a DropDownList item to the grid view, how to bind it and how to add the selection items to the list. My problem is that in all the examples I can find all show how to add the selection items from a database only. I don't always want to do that. Sometimes I want to add just from a...
3
12862
by: MU | last post by:
Hello I have a form with a dropdownlist on it and in the page_load I have this to populate it: Dim productsAdapter As New ProductsTableAdapter drpProducts.DataSource = productsAdapter.GetProducts() drpProducts.DataTextField = "Title" drpProducts.DataValueField = "ProductID" drpProducts.DataBind()
0
9734
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10653
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10395
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10137
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9211
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7674
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5700
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4352
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3027
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.