473,382 Members | 1,396 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,382 software developers and data experts.

Droplist in header template

Hello group,

I am using a data grid with template columns. I have a drop list in
the header of the template column that will allow users to select a
value for filtering of the data in the grid. When would I populate the
drop list?

Sean M. Severson

Nov 29 '06 #1
6 1588
In the Page_Load event.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"NerdRunner" <ss*******@2sts.bizwrote in message
news:11**********************@n67g2000cwd.googlegr oups.com...
Hello group,

I am using a data grid with template columns. I have a drop list in
the header of the template column that will allow users to select a
value for filtering of the data in the grid. When would I populate the
drop list?

Sean M. Severson

Nov 29 '06 #2
I have tried populating the drop lists on the Page_Load event, but I am
unable to get the drop list control. I am using
dgUsers.FindControl("ddlAccount") and it is not finding the control. I
have also tried dgUsers.Items(1).FindControl("ddlAccount") without any
luck.

Sean M. Severson

Eliyahu Goldin wrote:
In the Page_Load event.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"NerdRunner" <ss*******@2sts.bizwrote in message
news:11**********************@n67g2000cwd.googlegr oups.com...
Hello group,

I am using a data grid with template columns. I have a drop list in
the header of the template column that will allow users to select a
value for filtering of the data in the grid. When would I populate the
drop list?

Sean M. Severson
Nov 29 '06 #3
Ok, I thing my first advice was not correct.

Since the ddl is inside the header, you need to call the FindControl method
on the item representing the header.

dgUsers.FindControl("ddlAccount") is obviously not good because it doesn't
get inside any item.

dgUsers.Items(1).FindControl("ddlAccount") is not good either because Items
collection doesn't include the header item.

You can catch the header item in either ItemCreated or ItemDataBound event.
Use ItemType property to tell the header item. Once you have got the item,
call FindControl("ddlAccount") on the item instance.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"NerdRunner" <ss*******@2sts.bizwrote in message
news:11*********************@j72g2000cwa.googlegro ups.com...
I have tried populating the drop lists on the Page_Load event, but I am
unable to get the drop list control. I am using
dgUsers.FindControl("ddlAccount") and it is not finding the control. I
have also tried dgUsers.Items(1).FindControl("ddlAccount") without any
luck.

Sean M. Severson

Eliyahu Goldin wrote:
In the Page_Load event.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"NerdRunner" <ss*******@2sts.bizwrote in message
news:11**********************@n67g2000cwd.googlegr oups.com...
Hello group,
>
I am using a data grid with template columns. I have a drop list in
the header of the template column that will allow users to select a
value for filtering of the data in the grid. When would I populate
the
drop list?
>
Sean M. Severson
>

Nov 29 '06 #4
I believe your advice will help me, but I am getting an error on the
DataBind action on the data grid. This appears to be due to using a
function that creates a new datareader, populates the drop list
control, and then closes the datareader. The error I get is Invalid
attempt to FieldCount when reader is closed.

Can I have only one reader on a connection open at a time? Are all
readers closed when another reader is opened?

Sean M. Severson

Eliyahu Goldin wrote:
Ok, I thing my first advice was not correct.

Since the ddl is inside the header, you need to call the FindControl method
on the item representing the header.

dgUsers.FindControl("ddlAccount") is obviously not good because it doesn't
get inside any item.

dgUsers.Items(1).FindControl("ddlAccount") is not good either because Items
collection doesn't include the header item.

You can catch the header item in either ItemCreated or ItemDataBound event.
Use ItemType property to tell the header item. Once you have got the item,
call FindControl("ddlAccount") on the item instance.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"NerdRunner" <ss*******@2sts.bizwrote in message
news:11*********************@j72g2000cwa.googlegro ups.com...
I have tried populating the drop lists on the Page_Load event, but I am
unable to get the drop list control. I am using
dgUsers.FindControl("ddlAccount") and it is not finding the control. I
have also tried dgUsers.Items(1).FindControl("ddlAccount") without any
luck.

Sean M. Severson

Eliyahu Goldin wrote:
In the Page_Load event.
>
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
>
>
"NerdRunner" <ss*******@2sts.bizwrote in message
news:11**********************@n67g2000cwd.googlegr oups.com...
Hello group,

I am using a data grid with template columns. I have a drop list in
the header of the template column that will allow users to select a
value for filtering of the data in the grid. When would I populate
the
drop list?

Sean M. Severson
Nov 29 '06 #5
I believe your advice will help me, but I am getting an error on the
DataBind action on the data grid. This appears to be due to using a
function that creates a new datareader, populates the drop list
control, and then closes the datareader. The error I get is Invalid
attempt to FieldCount when reader is closed.

Can I have only one reader on a connection open at a time? Are all
readers closed when another reader is opened?

Sean M. Severson

Eliyahu Goldin wrote:
Ok, I thing my first advice was not correct.

Since the ddl is inside the header, you need to call the FindControl method
on the item representing the header.

dgUsers.FindControl("ddlAccount") is obviously not good because it doesn't
get inside any item.

dgUsers.Items(1).FindControl("ddlAccount") is not good either because Items
collection doesn't include the header item.

You can catch the header item in either ItemCreated or ItemDataBound event.
Use ItemType property to tell the header item. Once you have got the item,
call FindControl("ddlAccount") on the item instance.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"NerdRunner" <ss*******@2sts.bizwrote in message
news:11*********************@j72g2000cwa.googlegro ups.com...
I have tried populating the drop lists on the Page_Load event, but I am
unable to get the drop list control. I am using
dgUsers.FindControl("ddlAccount") and it is not finding the control. I
have also tried dgUsers.Items(1).FindControl("ddlAccount") without any
luck.

Sean M. Severson

Eliyahu Goldin wrote:
In the Page_Load event.
>
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
>
>
"NerdRunner" <ss*******@2sts.bizwrote in message
news:11**********************@n67g2000cwd.googlegr oups.com...
Hello group,

I am using a data grid with template columns. I have a drop list in
the header of the template column that will allow users to select a
value for filtering of the data in the grid. When would I populate
the
drop list?

Sean M. Severson
Nov 29 '06 #6
If you databind to a datareader, it has to be open at the time when you call
the DataBind method. It is hard to say anything more specific without seeing
the code.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"NerdRunner" <ss*******@2sts.bizwrote in message
news:11**********************@n67g2000cwd.googlegr oups.com...
I believe your advice will help me, but I am getting an error on the
DataBind action on the data grid. This appears to be due to using a
function that creates a new datareader, populates the drop list
control, and then closes the datareader. The error I get is Invalid
attempt to FieldCount when reader is closed.

Can I have only one reader on a connection open at a time? Are all
readers closed when another reader is opened?

Sean M. Severson

Eliyahu Goldin wrote:
Ok, I thing my first advice was not correct.

Since the ddl is inside the header, you need to call the FindControl
method
on the item representing the header.

dgUsers.FindControl("ddlAccount") is obviously not good because it
doesn't
get inside any item.

dgUsers.Items(1).FindControl("ddlAccount") is not good either because
Items
collection doesn't include the header item.

You can catch the header item in either ItemCreated or ItemDataBound
event.
Use ItemType property to tell the header item. Once you have got the
item,
call FindControl("ddlAccount") on the item instance.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"NerdRunner" <ss*******@2sts.bizwrote in message
news:11*********************@j72g2000cwa.googlegro ups.com...
I have tried populating the drop lists on the Page_Load event, but I
am
unable to get the drop list control. I am using
dgUsers.FindControl("ddlAccount") and it is not finding the control.
I
have also tried dgUsers.Items(1).FindControl("ddlAccount") without any
luck.
>
Sean M. Severson
>
Eliyahu Goldin wrote:
In the Page_Load event.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


"NerdRunner" <ss*******@2sts.bizwrote in message
news:11**********************@n67g2000cwd.googlegr oups.com...
Hello group,
>
I am using a data grid with template columns. I have a drop list
in
the header of the template column that will allow users to select
a
value for filtering of the data in the grid. When would I
populate
the
drop list?
>
Sean M. Severson
>
>

Nov 29 '06 #7

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

Similar topics

3
by: Stanley J Mroczek | last post by:
I am trying to load a droplist in VB when the edit is clicked in a datagrid. I tried to use OnDataBinding and loading the droplist in subroutine "loaddd". I get this error Object reference not set...
4
by: TJS | last post by:
After a post back the selected index should be rest in a droplist to match user's choice, but page always show selected item as first one in the droplist. How can iforce the selected item to be...
2
by: TJS | last post by:
need help with trying to set selected value on a droplist. -- tried vCaptainID as integer and string , no luck -- tried it in pre render and also after droplist is created , no luck =========...
5
by: TJS | last post by:
I need to add validation to drodownlist control but it sends back an error message that says: "System.Web.UI.WebControls.DropDownList' does not allow child controls" the code is : If...
2
by: TJS | last post by:
I have a control, called FieldBuilder, which generates a droplist dynamically for a form. I want to add validation to the droplist thru the 'OnItemCreated' function. i can't seem to get the...
0
by: yuchang | last post by:
Hi, I try to use a droplist control to show a list value from Database table "A", and the droplist control is an item of a formview control, its data from Database table "B". My problem is how...
36
by: zouyongbin | last post by:
Stanley B Lippman in his "C++ Primer" that a definition like this should not appear in a header file: int ix; The inclusion of any of these definitions in two or more files of the same...
0
by: anto.anish | last post by:
Hi , Since, i did not want to write all instantiations in Source file of all template methods for various different datatypes that my client might use, Instead, i choose to write implementation...
0
by: JRough | last post by:
I have the following code at the end of a page that lists some query results. It starts in a form that asks the user for input, one of two template pages. One template is a form for user input if...
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
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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.