Solved

implement file upload control as gmail in asp.net

Posted on 2011-03-12
8
767 Views
Last Modified: 2013-11-11
HI
I have  2 user controls
uc1.ascx--contains  Textbox, submit, Cancel buttons
uc2.ascx--contains Textbox,file Upload control, Submit,Cancel buttons

I have to uc1.ascx into default.aspx
in default.aspx When i click 'Submit' button it should open uc2.ascx as Popup using JQuery dialog

In the Popup first time 'Submit' button should be disabled as the user enters text into the textbox
the button is enabled.
using FileUpload control attaches files once attached the attached file name, a Remove button should appear below the fileUpload Control. Where 'Remove' is to remove the file.
If user clicks on the name of file name it should open in a separate window.

Here user can attach only 10 files.  Try to use JQuery dialog,usercontrol or any other way
0
Comment
Question by:praveen7k
  • 3
  • 3
  • 2
8 Comments
 
LVL 10

Expert Comment

by:gavsmith
ID: 35115815
Could you post your code for default.aspx?
0
 

Author Comment

by:praveen7k
ID: 35116201
there is some other code....in that page

there is a dropdown list, 2 link buttons to transfer to other pages
0
 

Author Comment

by:praveen7k
ID: 35116773
anyway open a popup from a user control and add the functionality as explained above
0
 
LVL 10

Accepted Solution

by:
gavsmith earned 500 total points
ID: 35121154
It might be possible but I think you will struggle with the control names. UC1 will not know what UC2 is called unless UC2 is part of UC1 (which may well make the UC pointless). Or you could place the code in Default.aspx if you make the UC's buttons public so default.aspx could access them like the following:

$("#<%= uc2.container.ClientID %>").dialog({autoOpen:false});
$("#<%= uc1.button1.CientID %>").click(funcion() { 
      $("#<%= uc2.submitButton.ClientID %>")").attr('disabled', 'disabled');
      $("#<%= uc2.container.ClientID %>").dialog("open");
});

Open in new window


Something similar to that anyway... container would have to be a div wrapping everything in UC2 which has runat="server" tag.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:praveen7k
ID: 35122855
Thanks, could you explain me in detail
and which is the best way to acheive this
0
 
LVL 10

Expert Comment

by:gavsmith
ID: 35127058
Explanation:

In jQuery you need to use client ID selectors to reference your elements.

.NET often renames your server controls when being rendered i.e if you are using masterpages your text box called textBox1, when rendered, has a client ID of 'ContentPlaceHolder1_textBox1'. It would also give it a name of 'ctl00$ContentPlaceHolder1$textBox1'.

Because of this to reference a server contol in script you are best to use the ClientID property of the server control, this must be done 'server side'.

You could create the script in code behind and use the RegisterClientScript method or do what I suggested above.

Best way to acheive this:

I can't really suggest a 'best way' as I don't know your full project design i.e. you might use your UC's in multiple other places for all I know, so getting your UC to register a clientscript may beak lots of other pages.
0
 
LVL 5

Expert Comment

by:vivekpv10
ID: 35127284
0
 
LVL 5

Expert Comment

by:vivekpv10
ID: 35127298
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now