473,769 Members | 4,089 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1632
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.c omwrote in message
news:11******** **************@ h48g2000cwc.goo glegroups.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
6036
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 the &nbsp; in handy: with "&nbsp;&nbsp;" you have two spaces. So with the nbsp entity you can create multiple spaces (in the display). Now i have an xml file with &nbsp; entities, i put it in an xsl-file that know xhtml entities.
12
47918
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 "&nbsp;" char - the non breaking space. Can this be represented in a grep statement at
2
3312
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 &nbsp;&nbsp;SubItem &nbsp;&nbsp;SubItem Thanks, --
2
1986
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 had no problem doing this, but now if I try to do something like this... boxOption.Items.Add(New ListItem("myFirstCol&nbsp;&nbsp;&nbsp;myLastCol")) ....it converts each & to a &amp;
1
1746
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. Is there any way by which &nbsp; can be retained as it is when dropdown throws the html part. THanks
9
5841
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 in it. If cell has no content at all, the borders do not show up (..strange) So I tried to insert text inside each cell which has no other content inside. Cell content is set in code:
1
9213
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 escapes the ampersand. It even does this for the htmlselect control. Thx ~PJ
28
13206
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 yow But, in firefox, for same html, getting this:
7
9788
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 need to do? I've tried using single quotes, double quotes and backslash. Thanks, Sean
0
9579
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
9422
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10208
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...
1
9987
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9857
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
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3952
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
2
3558
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.