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

Lost Dropdownlist....just &nbsp

OJ
Hi,
ASP.NET C# 2.0

I have a usercontrol which contains a Gridview. I create my own
DataTable to bind to the GridView, which then fires the RowDataBound
event of the the Gridview. Here I add a dropdownlist to the relevent
row.Cell. I then expose the GridView as a public property of the
usercontrol. This all works lovely. However, when I try to find the
dropdownlist by accessing the GridView property of the usercontrol on
the ASP next page, the dropdownlist does not appear to be there. The
cell in which it **should** reside has no control count, and a Text
property of " ". All the other data is accessible through the
Rows[x].Cells[y].Text property.

Does anybody recognise this behaviour and might suggest what I am
inevitabley doing wrong in this scenario?

Thanks,
OJ

Oct 11 '06 #1
2 1605
I wonder if the RowDataBound event is too late to add controls to the
gridview cells. I am not positive though, but I think this might be the
case.

I am interested to see a solid response.

Sean

OJ wrote:
Hi,
ASP.NET C# 2.0

I have a usercontrol which contains a Gridview. I create my own
DataTable to bind to the GridView, which then fires the RowDataBound
event of the the Gridview. Here I add a dropdownlist to the relevent
row.Cell. I then expose the GridView as a public property of the
usercontrol. This all works lovely. However, when I try to find the
dropdownlist by accessing the GridView property of the usercontrol on
the ASP next page, the dropdownlist does not appear to be there. The
cell in which it **should** reside has no control count, and a Text
property of " ". All the other data is accessible through the
Rows[x].Cells[y].Text property.

Does anybody recognise this behaviour and might suggest what I am
inevitabley doing wrong in this scenario?

Thanks,
OJ
Oct 11 '06 #2
you need to add the dropdown control on postback in the onint event. if you
use dynamic control, all work shoudl be done in onint not formload. form
load is for access controls after they are created, and received their
postback values. as a general pratice, you should not set form control
values in form load nor add any controls.

-- bruce (sqlwork.com)

"OJ" <of****@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Hi,
ASP.NET C# 2.0

I have a usercontrol which contains a Gridview. I create my own
DataTable to bind to the GridView, which then fires the RowDataBound
event of the the Gridview. Here I add a dropdownlist to the relevent
row.Cell. I then expose the GridView as a public property of the
usercontrol. This all works lovely. However, when I try to find the
dropdownlist by accessing the GridView property of the usercontrol on
the ASP next page, the dropdownlist does not appear to be there. The
cell in which it **should** reside has no control count, and a Text
property of "&nbsp;". All the other data is accessible through the
Rows[x].Cells[y].Text property.

Does anybody recognise this behaviour and might suggest what I am
inevitabley doing wrong in this scenario?

Thanks,
OJ

Oct 11 '06 #3

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

Similar topics

12
by: Tjerk Wolterink | last post by:
In XHTML the entity nbsp stands for   A normal space like " " is also displayed as an normal space, but multiple spaces like " " are interpreted as 1 space in the xhtml page. So there comes...
12
by: Robert Mark Bram | last post by:
Hi All, I am using the following trim function: function trim (str) { return str.replace(/^\s*/g, '').replace(/\s*$/g, ''); } The problem is that this doesn't trim instances of the...
2
by: Bill Green | last post by:
I am trying to add an indent to a Dropdown control. I prefix the text for the ListItem with a couple &nbsp; but it doesn't render the tags to spaces , instead the dropdown list shows: MainItem...
2
by: Rob T | last post by:
I have a dropdown list that I would like to put in a bunch of &nbsp;'s into it (I'm setting the font to a monospace font so I can show a couple of columns nice and neat). In the old asp days, I...
1
by: Vikram | last post by:
i am adding a row in dataset , in which i want to add &nbsp; (space chracter for html) and then want to bind dataset to asp.net dropdown list box. But & automatically converted to &amp chracter....
9
by: Jouni Karppinen | last post by:
I create a HTMLTable in my C# code and then add rows and cells into that table. I'm trying to set top and bottom border for each cell by using stylesheet and it works as far as cell has some text...
1
by: PJ | last post by:
Is it possible to prevent the drop down list from html encoding the text in ListItems? I would like to put some spaces to add padding to certain items with spaces, but when it it rendered asp.net...
28
by: entfred | last post by:
I have the following line of html: &nbsp;&nbsp1234&nbsp;&nbsp;&nbsp;&nbsp;&nbspabc&nbsp;&nbsp;&nbspyow In Internet Explorer 6.0, the columns look ok using the above html: 1234 abcd ...
7
by: Sebarry | last post by:
Hi, I'm having trouble creating a blank table row in Javascript using document.createElement( '&nbsp;' ). When I look at the generated source it has intrepreted it as <td>&amp;nbsp;</td>. What do I...
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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,...
0
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,...
0
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...

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.