Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to populate fields without runat=server tag

Status
Not open for further replies.

romh

Programmer
Jan 3, 2003
297
US
I need to populate certain text fields that are not inside the
form runat="server" tag. Is this possible in asp.net?
And I can;t have these form fields in the query string either.
I am trying to send this form with these fields to my credit card gateway. But if I include these fields within the form runat="server", the form never get submitted.

 
You can probably try to register a javascript from within your code behind, that will populate those html controls.
 
I found this faq code:



HTML code:
<form id="form1" name="form1" method="post" action="somepage.asp">
<input type="hidden" name="field1" id="field1">
</form>
<form id="form2" runat="server">
<asp:dropdownlist id="ddlItems" runat="server" Width="376px" AutoPostBack="True"></asp:dropdownlist>
<input id="btnSubmit" style="WIDTH: 73px; HEIGHT: 24px" type="button" value="Go" onclick="SetAspForm();">
</form>



javascript:
function SetAspForm()
{
var obj = document.form2.ddlItems;
var objIndex = obj.selectedIndex;
document.form1('field1').value = obj(objIndex).value;
form1.submit();
}



But my btnSubmit doesn;t do anything when I click on it
 
Looks like you need to add <input type="Submit"> to form1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top