Click here to Skip to main content
15,913,934 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionI have a form with a gridview. When clicking one row I want it to pass the data to a second form that already exist. Pin
Paul Hacker5-Oct-15 7:51
Paul Hacker5-Oct-15 7:51 
QuestionCan't load data from SQL Compact Edition database - MVC 4 Pin
Member 120616005-Oct-15 0:45
Member 120616005-Oct-15 0:45 
QuestionI can download file from listbox but I want it to save in specific folder in local... Pin
Member 120161064-Oct-15 23:15
Member 120161064-Oct-15 23:15 
AnswerRe: I can download file from listbox but I want it to save in specific folder in local... Pin
JHizzle5-Oct-15 0:41
JHizzle5-Oct-15 0:41 
QuestionI want to download file from list box. Could anyone help? Pin
Member 120161064-Oct-15 20:07
Member 120161064-Oct-15 20:07 
AnswerRe: I want to download file from list box. Could anyone help? Pin
Richard MacCutchan4-Oct-15 22:05
mveRichard MacCutchan4-Oct-15 22:05 
GeneralRe: I want to download file from list box. Could anyone help? Pin
Member 120161064-Oct-15 22:51
Member 120161064-Oct-15 22:51 
QuestionVS2015 - MVC - Getting a list of users for Admin Panel Pin
DeerBear3-Oct-15 2:05
DeerBear3-Oct-15 2:05 
Questionuse Ajax controls in handlebar template with HandelBar & Asp.net & Ajax Pin
mahadevkarekar2-Oct-15 1:22
mahadevkarekar2-Oct-15 1:22 
QuestionOpen files from listbox file listing in c# Pin
Member 120161061-Oct-15 17:26
Member 120161061-Oct-15 17:26 
AnswerRe: Open files from listbox file listing in c# Pin
Wendelius1-Oct-15 17:42
mentorWendelius1-Oct-15 17:42 
GeneralRe: Open files from listbox file listing in c# Pin
Member 120161061-Oct-15 17:58
Member 120161061-Oct-15 17:58 
GeneralRe: Open files from listbox file listing in c# Pin
Member 120161061-Oct-15 20:42
Member 120161061-Oct-15 20:42 
GeneralRe: Open files from listbox file listing in c# Pin
Wendelius1-Oct-15 21:02
mentorWendelius1-Oct-15 21:02 
GeneralRe: Open files from listbox file listing in c# Pin
Member 120161061-Oct-15 21:14
Member 120161061-Oct-15 21:14 
QuestionApp_GlobalResources and resx files, cannot find appropriate culture Pin
jkirkerx1-Oct-15 9:34
professionaljkirkerx1-Oct-15 9:34 
Answer[Solved] Re: App_GlobalResources and resx files, cannot find appropriate culture, masterpage Pin
jkirkerx1-Oct-15 13:50
professionaljkirkerx1-Oct-15 13:50 
Questionstart date end date not working Pin
Ekrem Tapan30-Sep-15 23:43
Ekrem Tapan30-Sep-15 23:43 
AnswerRe: start date end date not working Pin
Wendelius1-Oct-15 8:40
mentorWendelius1-Oct-15 8:40 
QuestionI wanted to upload Multiple Files With ListBox in ASP.NET Pin
Member 1201610630-Sep-15 16:33
Member 1201610630-Sep-15 16:33 
I wanted to upload Multiple Files With ListBox in ASP.NET but there is an error at specific place....
The error on :
File.Add(FileUpload1);
It showing error on 'File.Add'

asp:
XML
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
            <asp:FileUpload ID="FileUpload1" runat="server" AllowMultiple="true" style="z-index: 1; left: 420px; top: 315px; position: absolute; width: 285px; height: 22px" />
            <asp:Button ID="btnUpload" Text="Add" runat="server" OnClick ="UploadMultipleFiles" accept ="image/gif, image/jpeg, application/exe" style="z-index: 1; left: 425px; top: 535px; position: absolute" />
            <hr />
            <asp:Label ID="lbl_text" runat="server" ForeColor ="Red" style="z-index: 1; left: 701px; top: 495px; position: absolute" />
           <asp:ListBox ID="ListBox1" runat="server"  style="z-index: 1; left: 415px; top: 371px; position: absolute; width: 280px; height: 147px; margin-left: 3px; margin-top: 0px"></asp:ListBox>
        <asp:Button ID="btn_remove" runat="server" OnClick="btn_remove_Click" style="z-index: 1; left: 500px; top: 535px; position: absolute" Text="Remove" />


c#:
C#
///<link to upload button>
        protected void UploadMultipleFiles(object sender, EventArgs e)
        {
            try
            {
                if (FileUpload1.HasFile)
                {
                    if (FileUpload1.PostedFile.ContentLength > 0)
                    {
                        if (ListBox1.Items.Contains(new ListItem(System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName))))
                        {
                            lbl_text.Text = "File already in the ListBox";
                        }
                        else
                        {
                            File.Add(FileUpload1);
                            ListBox1.Items.Add(System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName));
                            lbl_text.Text = "Add another file or click Upload to save them all";
                        }
                    }
                    else
                    {
                        lbl_text.Text = "File size cannot be 0";
                    }
                }
                else
                {
                    lbl_text.Text = "Please select a file to add";
                }
            }
            catch (Exception ex)
            {
            }
        }
        ///</link>
///<link to remove button>
        protected void btn_remove_Click(object sender, EventArgs e)
        {
            if (ListBox1.Items.Count > 0)
        {
            if (ListBox1.SelectedIndex < 0)
            {
               Label1.Text = "Please select a file to remove";
            }
            else
            {
                File.RemoveAt(ListBox1.SelectedIndex);
                ListBox1.Items.Remove(ListBox1.SelectedItem.Text);
                lbl_text.Text = "File removed";
            }
       }
    }
        ///</link>

AnswerRe: I wanted to upload Multiple Files With ListBox in ASP.NET Pin
aarif moh shaikh1-Oct-15 0:29
professionalaarif moh shaikh1-Oct-15 0:29 
GeneralRe: I wanted to upload Multiple Files With ListBox in ASP.NET Pin
Member 120161061-Oct-15 17:12
Member 120161061-Oct-15 17:12 
GeneralRe: I wanted to upload Multiple Files With ListBox in ASP.NET Pin
Member 120161061-Oct-15 17:23
Member 120161061-Oct-15 17:23 
QuestionDisplay Image from MSSQL database into asp.net page using vb Pin
caffrey_130-Sep-15 4:52
caffrey_130-Sep-15 4:52 
AnswerRe: Display Image from MSSQL database into asp.net page using vb Pin
Wendelius30-Sep-15 5:01
mentorWendelius30-Sep-15 5:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.