I Want to create a tool box,toolbox contains image button and fileupload.These two buttons can be added at runtime(user can add any number of image button and fileupload button dynamically by click)

I Want to create a tool box,toolbox contains image button and fileupload buttons.These two buttons can be added at runtime(user can add any number of image button and fileupload button dynamically by click).

for every image user will browse images using fileuploader and he will add the image to that imagebutton at runtime.

 

how to write server side coding to upload the selected image and to set that image to imagebutton at runtime?

 

is it possible? any other way to do it?

 

 

advance thanks

0
ask123
9/4/2008 1:43:19 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

1 Replies
1553 Views

Similar Articles

[PageSpeed] 17

ask123:

I Want to create a tool box,toolbox contains image button and fileupload buttons.These two buttons can be added at runtime(user can add any number of image button and fileupload button dynamically by click).

for every image user will browse images using fileuploader and he will add the image to that imagebutton at runtime.

 

how to write server side coding to upload the selected image and to set that image to imagebutton at runtime?

 

is it possible? any other way to do it?

 

 

advance thanks

Hi ask123,

Based on my experience, when you do this at runtime, you should not allow the page post back, so the best way to do this is using JavaScript, please refer the following code,

 

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Documents</title>
    <script language="javascript" type="text/javascript">    
    function addFileUpload(){
            br = document.createElement("<br />");
            element = document.createElement("<input name='aradiobutton' type='file' />");
            divMain.appendChild(br);
            divMain.appendChild(element);
        }
    function getInfo()
    {
           obj = "";
           inputs = document.getElementsByTagName("input");
           for( i = 0 ; i< inputs.length; i++){
            if(inputs[i].type =="file"){
                obj += inputs[i].value;
                obj += "\n";
            }           
           } 
           alert(obj.toString());
    }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="divMain">
        <input id="btnAddFileUpload" type="button" value="Add" onclick="addFileUpload();" />        
        <input id="btnGetUploadFileNames" type="button" value="GetFileNames" onclick="getInfo();" />                
    </div>    
    </form>
</body>
</html>
 
Hong-Gang Chen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0
Hong
9/8/2008 4:53:39 AM
Reply:

Similar Artilces:

when is button not a button?
How can I substitute an .gif file for the default display of the button? I know there must be a simple way to do so.iisdem furoribus Use an asp:imagebutton and set the ImageUrl ... http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUIWebControlsImageButtonClassTopic.asp...

Adding a javascript button click event to create user button
Hi:  I have a screen to create a username. In the create user screen i ahve put my terms and conditions for the site. In order to create a username the user has to accept the terms and conditions, for that he needs to check the checkbox accepting the terms and conditions. My question is:     Where do i add the javascript(client side) button click event in order to chck whether the user has checked the checkbox or not. If he did not check the checkbox and username should not be created.Can anybody please help with this!Thanks....

Create Image Button as Print Button
Hi Friends, I am working on an project which was started in Visual Studio 2003. I have to create a Image Button as Print button on the Click Event of it i want to Print the Page. How can i detect my default printer and print the page? I know its quite big topic in itself. I am not expecting code or something, but a reference or an article ,would be also great help.   Thanks  Menon  You can simply use the window.print(); javascript function call. Hope this helps. www.hopeasp.net Thanks Dude, I will do go for this. Thanks Menon...

change other image button image by click html link button by javascript code ?
Hello friend,I want to know that how to change other image button image by click html link button by javascript code ?Please give me reply as soon as possible.Thanks,Rupen   You can try this:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> &nb...

website is not showing any BUTTON, IMAGE BUTTON, IMAGE BOX, ACTIVE HYPERLINK etc .
hi friends frist of all thanks for the previous help now there is new problem i am facing that is i made a website for ABC_COMPANY and store it in file system that is d:\ABC_COMPANY now i copy this folder into CD and paste it on my client's computer ( which is not connected to my computer ) in file system c:\Inetpub\wwwroot\ABC_COMPANY now when i try to run this website on his computer with writing the address in IE http://localhost/ABC_COMPANY/default.aspx the website runs BUT the website is not showing any BUTTON, IMAGE BUTTON, IMAGE BOX, ACTIVE HYPERLINK etc . the only thin...

Save button click two times "how can i restrict the one click of save button"
Hi All I have problem when user enter "save" button continually, that time it is calling two time of this page. it means it is auto post back is happen twice .. How can i restrict the save button when one hit of the "Enter" button" Regards.Venukarunakara rao u set enabled property to false.Thank uBaba Please remember to click "Mark as Answer" on this post if it helped you. Thank uBabaPlease remember to click "Mark as Answer" on this post if it helped you. HI Sri Once i disabled the save button of one click , i am not ...

button with image only .. size of button
How to display a "button with an image only", but to limit it's width to the image width plus a few px's? Also I need to show the button's boarders. Here is what I have, but the button is very wide: ..abutton { list-style-image: url("chrome://my/ext/somesub/buttons16.png"); -moz-image-region: rect(0px,32px, 16px,16px); } and in XUL <button class="abutton" tooltiptext="some hint" id="abuttonId" onclick="doit();" align="center"/> Adding min-width="0.1px" to the .abutton C...

Buttons Creating Buttons
I'm working on a web app where I dynamically add controls depending on the results from a sql query, no problem so far. One of the controls is a button that calls an event. Within that event I dynamically add some more controls to the page, including some more buttons that are supposed to call other events. Here is the problem, the second level of buttons do not call their events. You click the button and the page does a postback without the button events firing. From what I've found the reason is that the assigning of the event handler for the second buttons happens in an ...

Adding a button to a button
Hello!  In winforms I can easily add a button to a button like this:  private void InitializeButtons()    {   Button button1 = new Button();   button1.Width = 200;   button1.Height = 100;   Button button2 = new Button();   button2.Width = 100;   button2.Height = 50;   button1.Controls.Add(button2);   this.Controls.Add(button1);    }  In webforms (asp.net 2.0) I try to do the same with the following code:  private void In...

when the user clicks the image button to show the calendar extender on my web form it submits the whole form instead of showing the calendar??
when the user clicks the image button to show the calendar extender on my web form it submits the whole form instead of just showing the calendar??  I have another button that submits the form. my calendar image button is acting like a submit button also instead of acting like a calendar popout button. Does anybody know how I can set an image button to not submit the form and cause my validations to render. I only want it to pop out the Ajax calendar for the specific textbox?   <ajaxToolkit:CalendarExtender runat="server" TargetControlID="txt...

when i click submit button,then this page close and new page open.Problem is that after submit button click page take too much time to close.i want to put something like page loading image after "subm
when i click submit button,then this page close and new page open.Problem is that after submit button click page take too much time to close.i want to put something like page loading image after "submit button" click & i want to display this loading image till page will be close. please help...... Dim strscript As String strscript = "" strscript &= "window.close();" strscript &= "window.opener.location.reload();" strscript &= "" 'Literal1.Text = strscrip...

Creating a Dynamic button from another Dynamic Button
Hi, I have created a button Dynamically as follows: Button b=new Button(); b.Text="Hello"; this.Controls.Add(b); b.Show(); How to create another Button(some Button) when clicked on the above created button. You have to handle the on click event of the dynamic button. In the onclick event you can create another button in the same way as you have done. Remember to create the dynamic button on every post back other wise you will not be able to capture the click event..Vikram www.vikramlakhotia.comPlease mark the answer if it helped you try this link: http://support.mic...

Create/hide two new buttons after button click
Hi there...Well, I have small problem. Let me explain briefly...I have one ASP.NET Web Form (C# code) in which I do have one button to PRINT the content of the web Form...When I click the button for Printing, the UserControl (which I've made) is poping up with giving two choice of CONTINUE PRINTING or CANCEL PRINTNow... I want to make inside this when the user clicks CONTINUE PRINTING to popup new window which will ask the user to print 1 page or 2 page...I don't need the whole code... I need an idea or opinion on how to do this so ...Thanks, string theRightAnswer = "Mark As Ans...

Button clicked
I'm using the following VB code per DW .Net docs to try to get the name of the button I've clicked on in a Win Forms datawindow control. Dim buttonClicked As String buttonClicked = dw_setup.ObjectUnderMouse.Gob.Name.ToString() If buttonClicked = "b_1" Then MsgBox("Button 1 was Clicked!") ElseIf buttonClicked = "b_2" Then MsgBox("Button 2 was clicked!") ElseIf buttonClicked = "b_3" Then MsgBox("Button 3 was clicked!") End If It always returns "DataWindow" instead of the button name. It d...

Web resources about - I Want to create a tool box,toolbox contains image button and fileupload.These two buttons can be added at runtime(user can add any number of image button and fileupload button dynamically by click) - asp.net.web-forms

iPhone 5 A6 chip to dynamically up-clock up to 1.3GHz (and downclock too)?
Interesting video from our friends at TLDToday: If this is not just a Geekbench app glitch, it could indicate why that A6 processor is so 2X ...

Apple's Lightning port dynamically assigns pins to allow for reversible use
... a closer look at how Apple's new Lightning connector works, and has come to the conclusion that the 8 pins on each side of the plug are dynamically ...

iPhone 5 Lightning port dynamically reassigns pins
... of Apple's Lightning USB cable shows that the pins on the plug aren't arranged symmetrically, suggesting that the Lightning port can dynamically ...

Urlbox Launches Screenshots-as-a-Service Platform to Dynamically Update Galleries
... changes. Launched yesterday, Urlbox allows anyone with a gallery displaying website screenshots to automate the process and keep them dynamically ...

Everything.me launcher dynamically adapts to what you’re doing right now
... phone according to what you’re doing. Perform a search for ‘football’ and your background will change to the NFL logo. A launcher that dynamically ...


A YouTube Experiment Resizes the Player Dynamically
There's a new YouTube experiment that changes the video player's size, depending on the browser window's size. When resizing Chrome's window, ...

Apple Granted “Dynamically Changing Cursor for User Interface” Patent, Originally Filed in 2003
... a utility patent that covers the use of the mouse cursor that changes according to the context of the task it is engaged in. Called a “Dynamically ...

Atmel's FPSLIC II Dynamically Reconfigurable SoC Supports "Silicon-Sharing" For Peripherals & Interfaces ...
Silicon-Sharing Fits 200K Gate Design into 40K Gate FPSLIC II's, Cuts Power Drain by 97%

Everything.me Launcher Wants to Dynamically Change Phones Based on Location, Interests, and Mental State ...
What if your phone’s launcher dynamically changed based upon interests, your location, or topics you had in mind at a specific moment? A new ...

Resources last updated: 12/23/2015 5:50:50 AM