datagrid newbie 3 questions

J

jon L

have developed a webform using a datagrid, pulling data from the database. I
pull the data into an adapter then into a view so that I can have sorting and
paging. I have a few questions about the dg. Prety simple. Trying some
obvious embellishments:
in the update event I grab each value froem the datagridrow using something
like
String tiecode = ((TextBox)e.Item.Cells[3].Controls[0]).Text;
that works except:
1) if a field is read only mode then the above line gives the following error
"Specifeid argument was out of range of valid values " Ok . SO then my
question woulod be how do I read that field , from within my update event ?

2) if I make the field a template fieldwith an edit itemtemplate Ill get the
following error "Specified cast is not valid" As far as I can tell the cell
is a textbox. whats the magicval incantations?

3) Obviously the datagrid is more complex than my feeble mind can grasp.
What I ned is a book that concentrates on the DATAGRID. Any suggestions
Thanks in advance
JONL

3)
 
J

Jens Blom

Hi
try somthing like this


1)
textbox foo = (textbox)e.item.findControl["theNameOnTheTextBox"];

if(foo!= null)
response.write(foo.text);


do something like that
and it will work
(dont copy my code i havent test it and it contains some misspelled code )


3)
google.com :)

regards
Jens Blom


have developed a webform using a datagrid, pulling data from the database.
I
pull the data into an adapter then into a view so that I can have sorting
and
paging. I have a few questions about the dg. Prety simple. Trying some
obvious embellishments:
in the update event I grab each value froem the datagridrow using something
like
String tiecode = ((TextBox)e.Item.Cells[3].Controls[0]).Text;
that works except:
1) if a field is read only mode then the above line gives the following
error
"Specifeid argument was out of range of valid values " Ok . SO then my
question woulod be how do I read that field , from within my update event ?

2) if I make the field a template fieldwith an edit itemtemplate Ill get the
following error "Specified cast is not valid" As far as I can tell the cell
is a textbox. whats the magicval incantations?

3) Obviously the datagrid is more complex than my feeble mind can grasp.
What I ned is a book that concentrates on the DATAGRID. Any suggestions
Thanks in advance
JONL

3)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,142
Messages
2,570,819
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top