Click here to Skip to main content
Click here to Skip to main content

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

, 30 Sep 2010
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
Technical Lead TANVTECH
United States United States
More than 13 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

Comments and Discussions

 
GeneralMy vote of 3 PinmemberDev Sils10-Mar-14 2:48 
GeneralThis is not applicable when you are using Master pages. The ... PinmemberMember 27925345-Oct-10 1:32 
GeneralReason for my vote of 2 it can be easily find out on google PinmemberS M P3-Oct-10 1: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 | Mobile
Web04 | 2.8.140814.1 | Last Updated 30 Sep 2010
Article Copyright 2010 by T.Ashraf
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid