Programmatically changing value of a control within a template

  • Thread starter Thread starter cgdev1
  • Start date Start date
C

cgdev1

I'd like to use the ItemInserting event to check (and perhaps append) a
value before inserting it into my database. But, I don't know how to
get a handle on the control. I know I can't just use "textbox1" to
reference it. Is there a fully qualified name I should be using?

I can see the value by using:

e.Values["columnname"].ToString()

However, trying to change it this way doesn't work:

if (...)
{
e.Values["columnname"].ToString() +=
e.Values["columnname"].ToString() + "text I want to add"
}

What am I doing wrong here? How do I access/change the text value of
the control?

Thanks
 
Sorry, I noticed an error in my post, though there is still a problem.
Any ideas?


{
e.Values["columnname"] += "text I want to add";
}


Can you help?

Thanks
 
Another way to do this that might work better is to add the value in the
inserting event of the unerlying data source.
You can directly modify the e.Command.Arguments collection to set the value
to whatever it is you want.
Sagi
http://blog.shkedy.com
 
Back
Top