473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Post Back and HTML Controls

Hello.

I had a question that I was hoping someone might be able
to answer.

I have an ASP .NET Web Form with a custom control that
generates HTML based on certain criteria.

This control is on the web form. For example the control
will generate a question with an HTML input text box.

When my web form does a post how do I get the contents of
this text box?

When I do request.form.item("txtTextBox") it returns
nothing.

In the HTML of the web form the input text box shows-up
but I can't obtain the contents. Does someone know what
I'm doing wrong?

Thanks for your time,
Chris
Nov 18 '05 #1
4 4826
It's a custom control. Only you know how you wrote it to work.

--
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Chris" <an*******@discussions.microsoft.com> wrote in message
news:66****************************@phx.gbl...
Hello.

I had a question that I was hoping someone might be able
to answer.

I have an ASP .NET Web Form with a custom control that
generates HTML based on certain criteria.

This control is on the web form. For example the control
will generate a question with an HTML input text box.

When my web form does a post how do I get the contents of
this text box?

When I do request.form.item("txtTextBox") it returns
nothing.

In the HTML of the web form the input text box shows-up
but I can't obtain the contents. Does someone know what
I'm doing wrong?

Thanks for your time,
Chris

Nov 18 '05 #2
it depends on how you rendered the html text box.

if you rendered the html yourself, you must include a unique name attribute
that can be used to look it up in the form collection.

if you added a html text box control, it assigned a unique name based on the
id you gave it. generally
<your controls id>:<textbox id>
if you regen the control on postback (before form load), you can just ask
the subcontrol for its value.

-- bruce (sqlwork.com)
"Chris" <an*******@discussions.microsoft.com> wrote in message
news:66****************************@phx.gbl...
Hello.

I had a question that I was hoping someone might be able
to answer.

I have an ASP .NET Web Form with a custom control that
generates HTML based on certain criteria.

This control is on the web form. For example the control
will generate a question with an HTML input text box.

When my web form does a post how do I get the contents of
this text box?

When I do request.form.item("txtTextBox") it returns
nothing.

In the HTML of the web form the input text box shows-up
but I can't obtain the contents. Does someone know what
I'm doing wrong?

Thanks for your time,
Chris

Nov 18 '05 #3
on the control render I write out HTML
Protected Overrides Sub Render(ByVal output As
System.Web.UI.HtmlTextWriter)
If Me.Action = "register" Then
output.Write(getHTML)
ElseIf Me.Action = "confirm" Then
output.Write(getConfirmHTML)
End If
End Sub

The HTML that gets written is:
..Append("<TR><TD>")
..Append("&nbsp&nbspWhat is your clients's last name?
&nbsp&nbsp" & "</TD>" & vbCrLf)
..Append("<TD><INPUT id=" & """txtClientsName""" & "
type=" & """text""" & "><BR></TD></TR>" & vbCrLf)

simple question with a text box

My question is do I need to add a property within the
control to save the value or once the HTML is written to
the screen it now becomes part of the web form.

I'm trying to understand the process so I can obtain the
value of the control text box field.

Web form -> control -> write HTML output -> becomes part
of Web form and is rendered within table -> on post what
do I need to do to obtain the value?

Thanks
-----Original Message-----
It's a custom control. Only you know how you wrote it to work.
--
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Chris" <an*******@discussions.microsoft.com> wrote in messagenews:66****************************@phx.gbl...
Hello.

I had a question that I was hoping someone might be able to answer.

I have an ASP .NET Web Form with a custom control that
generates HTML based on certain criteria.

This control is on the web form. For example the control will generate a question with an HTML input text box.

When my web form does a post how do I get the contents of this text box?

When I do request.form.item("txtTextBox") it returns
nothing.

In the HTML of the web form the input text box shows-up
but I can't obtain the contents. Does someone know what
I'm doing wrong?

Thanks for your time,
Chris

.


Nov 18 '05 #4
Thanks I figured out my mistake. It needs a name property
along with id.
-----Original Message-----
on the control render I write out HTML
Protected Overrides Sub Render(ByVal output As
System.Web.UI.HtmlTextWriter)
If Me.Action = "register" Then
output.Write(getHTML)
ElseIf Me.Action = "confirm" Then
output.Write(getConfirmHTML)
End If
End Sub

The HTML that gets written is:
..Append("<TR><TD>")
..Append(" What is your clients's last name?
" & "</TD>" & vbCrLf)
..Append("<TD><INPUT id=" & """txtClientsName""" & "
type=" & """text""" & "><BR></TD></TR>" & vbCrLf)

simple question with a text box

My question is do I need to add a property within the
control to save the value or once the HTML is written to
the screen it now becomes part of the web form.

I'm trying to understand the process so I can obtain the
value of the control text box field.

Web form -> control -> write HTML output -> becomes part
of Web form and is rendered within table -> on post what
do I need to do to obtain the value?

Thanks
-----Original Message-----
It's a custom control. Only you know how you wrote it to
work.

--
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Chris" <an*******@discussions.microsoft.com> wrote inmessage
news:66****************************@phx.gbl...
Hello.

I had a question that I was hoping someone might be

able to answer.

I have an ASP .NET Web Form with a custom control that
generates HTML based on certain criteria.

This control is on the web form. For example thecontrol will generate a question with an HTML input text box.

When my web form does a post how do I get the contentsof
this text box?

When I do request.form.item("txtTextBox") it returns
nothing.

In the HTML of the web form the input text box shows-

up but I can't obtain the contents. Does someone know what I'm doing wrong?

Thanks for your time,
Chris

.


.

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Phillip N Rounds | last post by:
I have a webform, from which I have to submit info to another site. Their instructions are to have a html form, with the following as the submit: <form method="post"...
2
by: sk2000 | last post by:
Hello All, I'm creating a web form with user controls in different HTML table cells (User Controls are place in the table cells at design time ). For some reason none of the Button type...
5
by: shimonsim | last post by:
Hi, I need to upload pictures from client machine and I am using HtmlInputFile control I set validator to make sure that file has correct expention but if one of the files has incorrect extention...
3
by: Bruce W.1 | last post by:
I need to do a post on the client side (with an html button) to another aspx URL, while keeping the viewstates. So I made an html button with onClick="location.href='whatever.aspx?state=true'" ...
3
by: Brian Henry | last post by:
I have two list boxes on my form... lstCanSend and lstRecipients... well then there are two buttons add and remove between them (your basic select and pick listing) which uses java script to move...
2
by: Matt | last post by:
When we submit the form data to another page, we usually do the following: <form action="display.aspx" method="post"> will submit the form data and open display.asp in the current browser ...
3
by: James T. | last post by:
Hello! How I can force user controls to reload on post-back? Thank you! James
12
by: Michael Lang | last post by:
I'm adding checkbox controls to a panel in a post back, I then have a second post back in which I attempt to process the checkbox controls however they seem to have disappeared off the panel. The...
1
by: =?Utf-8?B?Z29yaWxsYQ==?= | last post by:
As we know , the view state is not responsible for having TextBoxes, CheckBoxes, DropDownLists, and other Web controls remember their values across postback. When I dynamically add a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.