Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9223303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:02:57+00:00 2026-06-18T04:02:57+00:00

I have a page that I am working on that I’m linking multiple user

  • 0

I have a page that I am working on that I’m linking multiple user controls to. The user control contains 3 buttons, an attach, clear and view button. When a user clicks on any control on the page, the resulting information is “dumped” into the last visible control on the page.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" MasterPageFile="DefaultPage.master" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register tagName="FileHandler" src="FileHandling.ascx" tagPrefix="ucFile" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Main" Runat="Server">
<asp:UpdatePanel ID="upPanel" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<table>
<tr>
<td>
<ucFile:FileHandler ID="fFile1" runat="server" />
</td>
<td>
<ucFile:FileHandler ID="fFile2" runat="server" />
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>

All file handling and processing is handled within the control, with an event when the upload to the file server is complete via a file name that was generated. When either button is clicked, the file name is always stored internal to the control in the last control’s text box.
Control code:

<table style="width: 50%;">
    <tr style="white-space: nowrap;">
        <td style="width: 1%;">
            <asp:Label runat="server" ID="lblFile" />
        </td>
        <td style="width: 20%;">
           <asp:TextBox ID="txtFile" CssClass="backColor" runat="server" OnTextChanged="FileInformationChanged" />
        </td>
        <td style="width: 1%">
            <%--<asp:Button runat="server" ID="btnUpload" CssClass="btn" Text="Attach"  OnClick="UploadFile"/>--%>
            <input type="button" id="btnUpload" class="btn" tabindex="30" value="Attach" onclick="SetupUpload();" />
        </td>
        <td style="width: 1%">
            <%--<asp:Button runat="server" ID="btnClear" Text="Clear" CssClass="btn" OnClick="ClearTextValue"/>--%>
            <input type="button" id="btnClearFile" class="btn" value="Clear" onclick="document.getElementById('<%=txtFile.ClientID%>').value = '';document.getElementById('<%=hfFile.ClientID%>').value = '';" />
        </td>
        <td style="width: 1%">
            <a href="#here" onclick="ViewLink(document.getElementById('<%=hfFile.ClientID%>').value, '')">View</a>
        </td>
        <td style="width: 1%">
            <asp:HiddenField ID="hfFile" runat="server" />
        </td>
    </tr>
</table>
<script type="text/javascript">
    var ItemPath = "";
    function SetupUpload(File) {
        ItemPath = File;
        VersionAttach('<%=UploadPath%>', 'true');
    }
    function UploadComplete(File) {
        document.getElementById('<%=txtFile.ClientID%>').value =  File.substring(File.lastIndexOf("/") + 1);
        document.getElementById('<%=hfFile.ClientID%>').value = File;
        alert('<%=txtFile.Text %>');
        alert('<%=ClientID %>')
    }
    function ViewLink(File, Alert) {
        if (File != "") {
            if (File.indexOf("../data/") != -1) {
                window.open(File, '_blank');
            }
            else {
                window.open('../data/<%=UploadPath%>/' + File, '_blank');
            }
        }
        else if (Alert == "") {
            alert('No file has been uploaded for this field.');
        }
    }
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T04:02:57+00:00Added an answer on June 18, 2026 at 4:02 am

    The way I got this to work in my case was to put a title on the input button (client control), then passing the value of the clientid of the control that I wanted (textbox in this case) to the function in the onclick event (client event). I then “force” the consumer of the control to use this information when the button is clicked. The reason for the question here was to find out if there is a better way of accomplishing this within the control instead of making the consumer of the control handle the data. This does work for my purpose, it just doesn’t seem as clean as I would have liked.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that contains a user control within an update panel. $(document).ready(function()
I have a user form that is working perfectly. The page makes use of
I am working with php and want to have a page that has a
Here's the code for a simple page I have that is not working: <head>
I have a couple of things I'm working on, namely a page that issues
I'm working with mod_rewrite, and using page titles e.g. About Us that have been
I have a page that lets the user edit the content of the page
I have a page that uses the Telerik RadListView control and a Telerik RadDataPager
I have a page that can be viewed by list or grid view through
I have a page that's working fine in Firefox 3.5.6 but not in IE

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.