p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 1.0 and 1.1 Professional (http://p2p.wrox.com/forumdisplay.php?f=57)
-   -   placeholder controls (http://p2p.wrox.com/showthread.php?t=58003)

rocksbhavesh May 17th, 2007 07:43 AM

placeholder controls
 
Deal all,

im generating textbox control dynamically at run time and place it on placeholder control....
now i want to insert some text into that textbox and update that text to database....

how can i do this???

Please help me...


dparsons May 17th, 2007 07:51 AM

Loop through the placeholders Control collection:

VB
For Each ctrl as Control in Placeholder.Controls
  If TypeOf ctrl is TextBox then
     Dim txt as TextBox = CType(ctrl, TextBox)
     txt.Text = "foo"
  End If
Next

C#
foreach(Control ctrl in Placeholder.Controls)
{
   if(ctrl is TextBox)
   {
      TextBox txt = (TextBox)ctrl;
      txt.Text = "foo";
   }
}

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========

rocksbhavesh May 17th, 2007 07:58 AM

i can insert text into text box....

but i cant use that text for inserting it to database with insert quary....

suppose im inserting text: hello world
now i want to insert that text to database...

how can i get that text for further use??


dparsons May 17th, 2007 08:11 AM

I don't understand what you mean. The methods i provided above will let you write values to the text box, so, if you want to READ values from the text box you would just change the method around:

string foo = txt.Text;
Dim foo as String = txt.Text;

Then you just send that data to your database methods.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========


All times are GMT -4. The time now is 07:22 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.