C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » HTML »

Html button onclick


Posted Date: 07 Oct 2009      Posted By: thiyagarajan      Member Level: Silver     Points: 1   Responses: 9



iam placing a html button in asp.net.. on the onclick event i want to insert some datas in to the tables using javascript.. how to do?




Responses

Author: Fool To Code    07 Oct 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

you can't do this with javascript. u will have to go in server side code.

<input type="button" id="htmlbutton" runat="server" value="click"/>

onServerClick event of html button
write the code for the database


thanks and regards
FoolToCode



Author: Anil Kumar Pandey    07 Oct 2009Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

hi,

Using the java script inserting in the data base in not possible try using the server side coding...

Thanks & Regards
Anil Kumar Pandey



Author: Chandru    07 Oct 2009Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

Hi,

We can do with ajax,

just create one function like below,

xmlhttprequestobject.open("POST","yours web page")
for ex yours web page = "sample.aspx?a=yours1value,b=2value)

in page load of yours webpage,
Just collect the passed values using
If (Request.InputStream != null)
{
string value1 = Request.QueryString["a"]
..brb
}
just update the received values to database.

Hope this helps,

Thx
Chandru
NetProgrammingHelp.com

Chandru
SilverlightScripting.com



Author: Anuraj    07 Oct 2009Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

You can't insert data to DB using pure javascript.

Thanks
Anuraj
THIS POSTING IS PROVIDED "AS IS" WITH NO WARRANTIES, AND CONFERS NO RIGHTS.
BEWARE OF BUGS IN THE ABOVE CODE; I HAVE ONLY PROVED IT CORRECT, NOT TRIED IT.
dotnetthoghts



Author: Sumit Kr Verma    09 Oct 2009Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

hi,

Check attached file.

Thanks

Sumit Kr. Verma



innerhtml.htm
Author: Alwyn    13 Oct 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

In the client side, add a hidden control.

<input type="hidden" id="submitType" runat="server"/>

then the html button should be like;

<input type="button" id="Insert" onclick="Insert()"/>

then add a javascript function;

<script language="javascript">
function Insert()
{
document.formname.submitType = "INSERT";
document.formname.action = "Asp.Net Page Name.aspx";
document.formname.submit()
}
</script>

in the asp.net pageload()

add the following code

if submitType.value == "INSERT"
{
write the code for insert here....
}

Thanks & Regards,
Alwyn Duraisingh.M



Author: Venkatesh Ellur    26 Oct 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

The simplest way to do this operation would be to use

Ajax Update panel
and perform the operation on the Sever side event.

THIS POSTING IS PROVIDED WITH NO WARRANTIES, BEWARE OF BUGS IN THE ABOVE CODE; I HAVE ONLY PROVED IT CORRECT AS PER MY KNOWLEDGE, NOT TRIED IT.

Regards
--------------------------
Venkatesh Ellur
+919886417764
venkatesh.ellur@gmail.com



Author: Yogesh Jain    29 Oct 2009Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

use ajax for this purpose

goto www.w3schools.com and search for ajax tutorial

Thanks & Regards
Yogesh Jain



Author: diyaa    14 Nov 2009Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

it's not possible in asp.net
thanx



Post Reply
You must Sign In to post a response.
Next : Need help ..... try this
Previous : I like to submit all html tutorials for web designing on dotnetspider how?
Return to Discussion Forum
Post New Message
Category: HTML

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use