473,582 Members | 3,083 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

asp.net datagrid textbox blank in edit mode or "not set to an instance" error

I've seen a few posts on this issue, but no clear solutions.

I have a mulitiline textbox inside a datagrid.

I use TemplateColumn to define as multiline with 3 rows.

I have other field types like drop downs that have no issue displaying
last values in edit mode with seemingly more complicated code.

when I attempt to find my textbox with

Dim ddlxnotes2 As textbox =
UserGrid.Items( e.Item.ItemInde x).FindControl( "xnotes")
ddlxnotes2.text = ctype(e.item.Fi ndControl("xnot es"), TextBox).text

I get error:
Object reference not set to an instance of an object

I've tried to simply enter the number

ddlxnotes2.text = e.Item.Cells(5) .text

but that produces a blank field in edit mode. When I change the feild
number (from 5) to other fields numbers it does load their set value.

I tried removing multiline and rows=3 from the asp:textbox tag, but the
error persist and the field is blank. I am sure it's field number 5 on
the datagrid as it's the last field, 4 works and 6 produces an out of
range.
here's the complete field TAG

asp:TemplateCol umn HeaderText="Not es">
<itemstyle width=200 />
<ItemTemplate >
<asp:Label runat="server" Text='<%# Container.DataI tem("xnotes") %>'
ID="Lblnotes"/>
</ItemTemplate>
<EditItemTempla te>
<asp:textbox textmode=multil ine rows=3 width=400 runat="server"
id="xnotes">
</asp:textbox>
</EditItemTemplat e>
</asp:TemplateCol umn>
Thanks in advance for any help or information!

Nov 19 '05 #1
1 1724
GOING NUTS...

' this does not work - one of many attempts
Dim ddlxnotes As TextBox =
Usergrid.Items( e.Item.ItemInde x).FindControl( "xnotes")
ddlxnotes.text =
ctype(Usergrid. Items(e.Item.It emIndex).FindCo ntrol("xnotes") ,textbox).text
' this works but reall need cell 5 which shows up blank
' Dim ddlxnotes As TextBox =
Usergrid.Items( e.Item.ItemInde x).FindControl( "xnotes")
' ddlxnotes.text = e.Item.cells(4) .text

' this works
' Dim ddlxnotes As TextBox =
Usergrid.Items( e.Item.ItemInde x).FindControl( "xnotes")
' ddlxnotes.text = "x"
<asp:TemplateCo lumn HeaderText="Not es">
<itemstyle width=400 />
<ItemTemplate >
<asp:Label runat="server" Text='<%# Container.DataI tem("xnotes") %>'
ID="Lblnotes"/>
</ItemTemplate>
<EditItemTempla te>
<asp:textbox textmode=multil ine rows=3 width=400 runat="server"
id="xnotes">
</asp:textbox>
</EditItemTemplat e>
</asp:TemplateCol umn>
Everything else on the datagrid , including so Edititemtemplat es for
dropdowns displays the last value in edit mode....
What on earth am I doing wrong?

Nov 19 '05 #2

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

Similar topics

1
8063
by: Kenjis Kaan | last post by:
I had to run DB2 on Win2k. After installation it puts a directory under c:\DB2 and c:\DB2Log and C:\Program Files\SQLLIB Now am all confused which is instance home, db2 home etc. I had to configure tivoli inventory and its all *@#$ up because of this confusion. Can someone please clarify which is which? TIA c:\DB2>wgetrim invdh_1...
3
3970
by: Ken | last post by:
I have a win 2000 database of autographs and scanned photos. They are in the SAME directory. In the table, my "ImagePath" text field shows JUST the image name (i.e. "blank.jpg"). I have an image field that links to the ImagePath field. But it does not display in the form. I go in and delete the image field and add it back in and link it to...
1
1171
by: Brad Simon | last post by:
Hi all, First of all, what just happened to the Datagrid discussions? Second, I have posted this one before, and I still can't fix this. I am using a datagrid to display paged data. Whenever you click on the page you want to see, it won't do anything. I notice that I have a JavaScript Error: Expected ';' in line blah bah. The line that...
5
1702
by: Patrick.O.Ige | last post by:
Hi Guys, I have a datagrid wit editing and updating. But after adding Paging IT WON'T PAGE!! It compiles well but when i click on the paging link it doesn't go to the next link.. When i remove AllowCutomPaging it gives error:- "AllowCustomPaging must be true and VirtualItemCount must be set for a DataGrid with ID MenuGrid when AllowPaging...
1
1670
by: tshad | last post by:
I can't seem to get insert into a DataGrid to work. I am using an example from the net and made changes to work on my computer. The grid comes up fine. The edit boxes in the footer are there. But when I press the "insert" link, it never seems to go to the DataGrid1_ItemCommand routine. ...
2
2005
by: jason | last post by:
Pardon my ignorance on this. The below code works, except, when I edit a record and update the two drop downs take the first entry in the dropdownlist if not selected. I'd also like the dropdown to show the current value in edit mode. I'm sure this is a common question. I've reviewed several related post and tried them out to no avial. Some of...
9
1580
by: A P | last post by:
Hi! I have created a sample datagrid that can update data on a database. Please help me solve the problem, I have attached both aspx and code behind (aspx.vb): ______________________ datagrid.aspx
0
1067
by: tshad | last post by:
On my VS 2003 Windows Forms page I am trying to reuse my DataTable dependant on the users preference. This is easy in Asp.net, but apparently not as easy here. If I do the following code, where I remove the Emails Table from the DataSet, it gives me an error at the line: EmailDataGrid.TableStyles.Add(dgStyle) with the error:
11
4226
by: Anil Gupte/iCinema.com | last post by:
When I use this Dim instance As New Timer I get the error: Error 1 Overload resolution failed because no accessible 'New' accepts this number of arguments. Yet, in the help section for Timer (in VB 2005) this is exactly the syntax shown. I also tried:
0
7809
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...
0
8159
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. ...
0
8312
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...
1
7920
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...
0
8183
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...
0
6569
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...
1
5685
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...
0
3835
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2312
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

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.