Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > FindControl Method always returns empty string!!!!!

Reply
Thread Tools

FindControl Method always returns empty string!!!!!

 
 
steroche
Guest
Posts: n/a
 
      08-25-2005
Hi guys - Can somebody please help me?
I'm a novice at all thisIve run into a serious stumbling block for the
last few hours now and its killing me!
I have a paged/sorted Datagrid setup and it works fine except for the
update method - i just cannot get it to work!
Now i keep getting the error :

Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object
on line
Line 486: this.dsGarda.Tables["Garda"].Rows[e.Item.ItemIndex][3]
= newCaseID;

Here is my update method:

private void dgGarda_UpdateCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
string newCaseID, newStationID = null;
string newLname,newRank,newArea = null;

TextBox tb;
//all tb.Text vals = "" below
tb =
(TextBox)(dgGarda.Items[dgGarda.EditItemIndex].FindControl("txtEditCase"));
newCaseID = tb.Text.ToString();
tb =
(TextBox)(dgGarda.Items[dgGarda.EditItemIndex].FindControl("txtEditStation"));
newStationID = tb.Text;
tb =
(TextBox)(dgGarda.Items[dgGarda.EditItemIndex].FindControl("txtEditRank"));
newRank = tb.Text;
tb =
(TextBox)(dgGarda.Items[dgGarda.EditItemIndex].FindControl("txtEditArea"));
newArea = tb.Text;

this.dsGarda.Tables[1].Rows[e.Item.ItemIndex][3] = newCaseID;
this.dsGarda.Tables["Garda"].Rows[e.Item.ItemIndex][4] = newStationID;
this.dsGarda.Tables["Garda"].Rows[e.Item.ItemIndex][5] =
newRank;this.dsGarda.Tables["Garda"].Rows[e.Item.ItemIndex][6] =
newArea;

this.daGarda.Update(dsGarda, "Garda");
dgCase.EditItemIndex = -1;
dgCase.DataBind();
}

When i step through the code i see that all my FindControl methods are
returning empty strings aswell!!Anybody have any idea whats going on??I
read somewhere i should have the datagrid.databind call in the if
(!IsPostBack) but when i did this it didn't reload the grid when i
clicked edit.

Any help is greatly appreciated as i think i am going to kill my
computer shortly if i cant fix this!!!

Thanks,
Steve

 
Reply With Quote
 
 
 
 
steroche
Guest
Posts: n/a
 
      08-25-2005
Please Help Me!!! :- (

 
Reply With Quote
 
 
 
 
steroche
Guest
Posts: n/a
 
      08-25-2005
One problem down, was rebinding old data each time i went to upload- in
the DataGrid1_EditCommand - which is odd,didn't think that would effect
the subsequent DataGrid1_UpdateCommand but evidently it does!

 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Membership.GetAllusers Method always returns FALSE. Help me. Anjan ASP .Net 0 03-15-2007 06:18 AM
document.cookie always returns empty string Michi Henning Javascript 6 01-18-2007 12:00 PM
FindControl Method always returns empty string!!!!! steroche ASP .Net Web Controls 2 08-25-2005 03:15 AM
FindControl Method always returns empty string!!!!! steroche ASP .Net Datagrid Control 2 08-25-2005 03:15 AM
Request.Form("textbox1") always returns empty after Refresh? al ASP .Net 7 06-17-2004 07:43 PM



Advertisments