Click here to Skip to main content
11,429,399 members (67,624 online)
Click here to Skip to main content

How to get Value from from usercontrol to aspx page using Javascript

, 30 Sep 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
Pass value between user control and aspx page
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>TanvTech Code</title>
     <script type="text/javascript">
 function GetDatafromControl()
 {
    var val=document.forms[0]['MyAccessValueFromUserControl_AccessNameTextBox'];
        document.forms[0].NameTextBox.value=val.value
 }
 </script>
</head>
 
<body>
    <form id="form1" runat="server">
    <div>
    <table>
    <tr>
    <td style="width: 210px">
        <uc1:AccessValueFromUserControl id="MyAccessValueFromUserControl" runat="server">
        </uc1:AccessValueFromUserControl></td>
    <td style="width: 359px">
        <asp:TextBox ID="NameTextBox" runat="server" ></asp:TextBox>
        <asp:Button ID="GetButton" runat="server"  OnClientClick="GetDatafromControl();" Text="Get"  OnClick="GetButton_Click"/></td>
    </tr>
    </table>
    </div>
    </form>
</body>
</html>
 

License

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

Share

About the Author

T.Ashraf
Chief Technology Officer Compuacademy.net
United States United States
More than 15 years of experience in design, architecture and development of various commercial objects oriented application.Other Specialties

Data Migration:
• MS Access database to SQL 2005/2008
• MS Access database to Oracle
• MS Access database to My SQL
• FoxPro to SQL

Application Migration:
• Converted MS Access application to .net web application (Asp.net)
• Excel Application to .net 3.5 web application
• FoxPro application to .net 3.5
Reporting development and support
• MS access reports
• Crystal reports
• SQL Reports(SSRS)
• DevExpress reports
• Cognos reports
Application development and support
• .net Application web /Win forms
• SharePoint
• MS Access
• Website
• Ecommerce
• WCF
• Web Services
3rd Party Control Support
• DevExpress
• .netForum
• Telerik
Version controls Support
• Team Foundation Server
• Source Safe
• CVS
• SVN
Follow on   LinkedIn

Comments and Discussions

 
GeneralMy vote of 3 Pin
Dev Sils10-Mar-14 3:48
memberDev Sils10-Mar-14 3:48 
GeneralThis is not applicable when you are using Master pages. The ... Pin
Member 27925345-Oct-10 2:32
memberMember 27925345-Oct-10 2:32 
GeneralReason for my vote of 2 it can be easily find out on google Pin
S M P3-Oct-10 2:19
memberS M P3-Oct-10 2:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150428.2 | Last Updated 30 Sep 2010
Article Copyright 2010 by T.Ashraf
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid