473,498 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to make the other control visible

375 Contributor
Hi
I have a fileupload control in asp.net and another normal button.

What I want to do is I want the Normal Button to be enabled only after the files has been chosen in the FileUpload control.

Can anyone help me please


regards
cmrhema
Jul 11 '08 #1
3 2107
shweta123
692 Recognized Expert Contributor
Hi,

You can check if files has beed selected or not into FileUpload control using FileName property.
e.g.

''Check if file is selected for uploading

If FileUpload1.FileName <> "" Then
''Write code to enable button
End If
Jul 11 '08 #2
Frinavale
9,735 Recognized Expert Moderator Expert
Hi
I have a fileupload control in asp.net and another normal button.

What I want to do is I want the Normal Button to be enabled only after the files has been chosen in the FileUpload control.

Can anyone help me please


regards
cmrhema
You are going to have to have a bit of JavaScript check to see if anything has been provided by the user.

I would create a function that would be executed on the FileUpload's "onchange" JavaScript event:

eg:
Expand|Select|Wrap|Line Numbers
  1. myPhotoUpload.Attributes.Add("onchange","EnableUploadButton('" + myUploadButton + "')")
  2.  
Where the JavaScript function "EnableUploadButton" would resemble something like:
Expand|Select|Wrap|Line Numbers
  1. function EnableUploadButton(idOfButton)
  2. {
  3.     var button = document.getElementByID(idOfButton).disabled = false;
  4. }
  5.  
You will have to set your upload button to be initially rendered in the browser as "disabled".

Cheers!

-Frinny
Jul 11 '08 #3
cmrhema
375 Contributor
You are going to have to have a bit of JavaScript check to see if anything has been provided by the user.

I would create a function that would be executed on the FileUpload's "onchange" JavaScript event:

eg:
Expand|Select|Wrap|Line Numbers
  1. myPhotoUpload.Attributes.Add("onchange","EnableUploadButton('" + myUploadButton + "')")
  2.  
Where the JavaScript function "EnableUploadButton" would resemble something like:
Expand|Select|Wrap|Line Numbers
  1. function EnableUploadButton(idOfButton)
  2. {
  3.     var button = document.getElementByID(idOfButton).disabled = false;
  4. }
  5.  
You will have to set your upload button to be initially rendered in the browser as "disabled".

Cheers!

-Frinny
Many Thanks Frinnvale, it works now
Jul 12 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
9462
by: Paul Schnitter | last post by:
Update: My custom control is based on the article "Creating Visual Basic .NET controls from scratch" in "Adventures in .NET" on MSDN. It is designed to be a replacement for the VB6 shape...
15
1712
by: Pasta Bolognese | last post by:
Open VS.2003. Click on a control on an aspx page in the HTML view. Does it tell me the pixel position on the page? Nooooooooooo.................
5
4304
by: Charles | last post by:
Hello, I would like for my users to have a calendar control only when needed. IE button click for the control to appear and then once the date is selected. Populate a text box and the calendar...
2
1952
by: john | last post by:
I have some controls that I want to be invisible, but if the user does something, they will become visible using javascript. So I can't set its "visible" property to false, because then they won't...
6
14672
by: Selden McCabe | last post by:
I have a form with a bunch of image buttons. When the user moves the mouse over a button, I want to do two things: 1. change the Imagebutton's picture, and 2. make another control visible. I'm...
16
11489
by: Miguel Dias Moura | last post by:
Hello, i have 5 panels in an ASP.net / VB page. The panel 1 is visible the other 4 are NOT visible. I also have 5 images: image 1, image 2, ..., image5. When i click one of the images,...
3
1864
by: velu | last post by:
How to Pass Panel visibility property to other page? I have a scenario here. I have created a user control that has a button and panel visible set to false. When I click the button if the...
15
6469
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
0
1416
by: cvijaykrishna | last post by:
i am having a web based application and i am having a problem with it pls check it Explanationi am sending a sample code plese see it in VS-2005 FOR BETTER UNFERSTANDING I have a main page...
5
2978
by: programmerboy | last post by:
I never had this kind of issue before and it is completely surprising. I have a usercontrol where I need 2 forms to make 1 form. When I have only 1 form it submits the page to itself. I have spent...
0
7125
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7165
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7379
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5462
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4588
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3081
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1417
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
290
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.