Programmatically changing value of a control within a template

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
 
C

cgdev1

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
 
S

Shkedy

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
 

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

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top