Click here to Skip to main content
11,491,459 members (72,002 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP:NET
How to pass html textbox value to asp.net textbox and how to save it on mysql database????

below code is for html textbox and button i need to save this textbox value to mysql database
<input type="visible" name="amount" value="" />
<input type="image" name="submit" 
                            src="http://images.paypal.com/images/x-click-butcc.gif" border="0" 
                            alt="Make payments with PayPal, it's fast, free, and secure!" 
                            style="width: 147px; height: 52px;" />
here i need to pass html textbox value to asp.net textbox and using ap.net button click i need to save the textbox value to database..below code is asp.net textbox....
<asp:TextBox ID="TextBox49" runat="server">
<asp:Button ID="Button17" runat="server" Text="Button" />
Posted 30-Sep-12 19:57pm
Edited 30-Sep-12 22:49pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

if u r using html text and button inside aspx page then u should try like this ;

<input id="customerPhone" name="customerPhone" type="Text" />
<button OnServerClick=" Btn_Click" runat="server" id="Button1" />

// In .cs code write

protected void Btn_Click(object sender, EventArgs e)
 {
     string n = String.Format("{0}", Request.Form["customerPhone"]);
 
 }
  Permalink  
Comments
CL Anoop Chandran at 1-Oct-12 4:16am
   
thanks for ur reply again.... i did like this

<input id="amount" name="amount" value="" />

on button click

protected void Btn_Click(object sender, EventArgs e)
{
string n = String.Format("{0}", Request.Form["amount"]);
TextBox1.Text = n;



}


but its not displaying value on textbox1
solanki.net at 1-Oct-12 5:17am
   
Because here <input id="amount" name="amount" value="" /> u did not set type
i mean u should write like that :

<input id="amount" name="amount" type="text" value="" />


Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

add runat="server" in your html text and assign htmltextbox.value=textbox.text;

when you add runat="server" in html tag, You can access that tag on codebehind page.
to accesss html textbox value you have to write htmltextbox.value="";
  Permalink  
v2
Comments
CL Anoop Chandran at 1-Oct-12 6:37am
   
i gave runat="server" in html text code...but its showing error....

i have html textbox and button....i need to save textbox value to mysql database......
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

can u explain when u want to get html text value in asp.net text ?
  Permalink  
Comments
CL Anoop Chandran at 1-Oct-12 1:31am
   
Thanks for ur replay....i have html textbox and button....i need to save the textbox value to database ...when i click on button....

this is html tetxtbox and button code

<input type="visible" name="amount" value="" />


<input type="image" name="submit"
src="http://images.paypal.com/images/x-click-butcc.gif" border="0"
alt="Make payments with PayPal, it's fast, free, and secure!"
style="width: 147px; height: 52px;" />

i know only in asp.net...dont know in html......

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 521
1 Andy Lanng 303
2 Sascha Lefèvre 240
3 Maciej Los 235
4 OriginalGriff 165
0 Sergey Alexandrovich Kryukov 9,829
1 OriginalGriff 8,520
2 Sascha Lefèvre 3,574
3 Maciej Los 3,151
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web01 | 2.8.150520.1 | Last Updated 1 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100