.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old June 23rd, 2001, 02:16 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,578 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
Problem in Grid_Update

<i><b>Originally posted by : Spy++ (spy@usa.net)</b></i><br /><br />Hi,<br />I wrote the message "Grid.DataKeys problem". Well, forget that problem, I<br />discovered something new. In the Update event I have this code:<br /><br />string sValue1="";<br />string sValue2="";<br />TextBox Text1 = (TextBox)e.Item.FindControl("Text1");<br />TextBox Text2 = (TextBox)e.Item.FindControl("Text2");<br />sValue1=Text1 .Text;<br />sValue2=Text2 .Text;<br /><br />If I run the code, I got an error at line sValue1=Text1 .Text; saying<br />"Unable to dereference a null pointer". But if I debug and put a breakpoint<br />on that line, I can see that the textbox is found and the value is read!! So<br />why I get the exception. I managed to "fix" the problem in this way:<br /><br />string sValue1="";<br />string sValue2="";<br />TextBox Text1 = (TextBox)e.Item.FindControl("Text1");<br />TextBox Text2 = (TextBox)e.Item.FindControl("Text2");<br />if (Text1 !=null) sValue1=Text1 .Text;<br />if (Text2 !=null) sValue2=Text2 .Text;<br /><br /><br />Of course the are always found, so I can't see why I got the error if I<br />don't test if they are null!! Any solution or explanation? I don't like the<br />way I fixed it...<br /><br />And an other point: the value I get from the Text property is the old one,<br />the value before editing: why I don't get the current TextBox's value? Are<br />these problems related?<br />Please help...<br />Thank you<br /><br />

Reply With Quote
Reply

Viewing: ASP Free ForumsProgramming.NET Development > Problem in Grid_Update


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway