Showing posts with label input. Show all posts
Showing posts with label input. Show all posts

Wednesday, March 28, 2012

TableCell.Text property overwrites dynamic control

If I add a hidden input control to a tablecell and then set the cell's text
property, the hidden control is not output. If I set the text first, then
the hidden control is output but the text is not. No errors are generated.
I can make it work by adding a literal control instead of using the text
property, but why doesn't the "simple" method work?

Dim tCell As TableCell = New TableCell
Dim thidden As HtmlInputHidden = New HtmlInputHidden
thidden.ID = "h1"
thidden.Value = "hidden text"
tCell.Controls.Add(thidden)
tCell.Text = "visible text"
tRow.Cells.Add(tCell)Maybe add the text as a literal?

Joe

"Bob Voss" <bvoss@.Xspam.tsts.com> wrote in message
news:%23iH0xNNxDHA.2408@.tk2msftngp13.phx.gbl...
> If I add a hidden input control to a tablecell and then set the cell's
text
> property, the hidden control is not output. If I set the text first, then
> the hidden control is output but the text is not. No errors are
generated.
> I can make it work by adding a literal control instead of using the text
> property, but why doesn't the "simple" method work?
> Dim tCell As TableCell = New TableCell
> Dim thidden As HtmlInputHidden = New HtmlInputHidden
> thidden.ID = "h1"
> thidden.Value = "hidden text"
> tCell.Controls.Add(thidden)
> tCell.Text = "visible text"
> tRow.Cells.Add(tCell)

Thursday, March 22, 2012

take only the "number" from QueryString - how?

hi,

i have a stored procedure witch returns details about a picture and wich have an input parameter (PictureID)

the page is something like this "Picture.aspx?PictureID=5"

how can i take only the 5 from the Rrequest.QueryString["PictureID"] to use it as input parameter to stored procedure?

thanks

Are you asking how to get the value from the querystring, or how to give it as a parameter to your sproc?

Getting the value is simple. Convert.ToInt32(Request.QueryString["PictureID"])


Hello zuperboy,

Use in the page_load event:

int PictureId = Convert.ToInt32(Request.QueyString["PictureID"]);

Set PictureId as the input parameter of the stored procedure. I guess you know how that part works.

Jeroen Molenaar.


thank you to you two, this was easy:P