I want to upload multiple images in,but it is not selcting multiple images
<div class="col-md-4">
<div class="form-group m-b">
<label>Small Image</label>
<asp:FileUpload ID="fileUp1" runat="server" AllowMultiple="true"
CssClass="form-control" />
<small style="color: red;">Image Size Should be 280*282 px</small>
</div>
</div>
Might be of an issue of asp control. Check attribute multiple is present after rendering by inspecting the file upload control in dev tools
If not add it explicitly
<asp:FileUpload ID="fileUp1" runat="server" multiple CssClass="form-control" />
Related
I have few Textbox, FileUpload and button controls within the same page. I had tried enabling the EnableViewState to True but it is still not working. The Textbox will lose its value when clicking the button to upload attachments. May I know what's wrong here, should I use ViewState to retain the values of the textboxes?
<div class="form-row">
<div class="form-group col-md-6" >
<asp:Label ID="lblConfiguration" runat="server" Text="Configuration*"></asp:Label>
<asp:TextBox ID="txtConfiguration" runat="server" type="text" class="form-control" EnableViewState="true" ViewStateMode="Enabled" ></asp:TextBox>
</div>
<div class="form-group col-md-12">
<div class="col-md-6">
<asp:FileUpload ID="fuUpload" runat="server" CssClass="nv-file-select uploader" multiple="true" />
<br />
<asp:Button ID="btnUpload" runat="server" Text="Upload" OnClick="btnUpload_Click" CssClass="btn btn-secondary" />
</div>
</div>
Possible reasons
1) You have disable the Viewstate on full page - Check on top of aspx page if its enable or not
<%# Control Language="C#" AutoEventWireup="true" CodeFile="FileName.ascx.cs" EnableViewState="true" %>
2) At some point on code behind you change the value on post back - so check to not change it by adding this check
if (!Page.IsPostBack)
{
TextBox.Text = "";
}
3) For some reason after your post back you do redirect on same page.
4) For some reason you do not make post back, but reload
I am making a website (www.jocogolocal.com), and one of the objectives is to use Twitter bootstrapping to make all contents of the site fit the screen and eliminate as much white space as possible, but I feel like I am stuck because despite my efforts, it is not formatting the way I would like it, and sometimes it would even break the site with how bad / big the content / image banner gets. below is the code of both the master page and the page with the content, View Vendor, any help will be highly appreciated.
Master page
<asp:Table runat="server">
<asp:TableRow>
<asp:TableCell>
<div class="container">
<div class="row">
<div class="jumbotron">
<div class="container">
<asp:Image runat="server" ImageAlign="Middle" ImageUrl="~/Images/JoCoGoBanner.png" class="img-responsive col-lg-12 col-md-12 col-sm-12 "/>
</div>
</div>
</div>
</div>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
<br />
View Vendor
<ItemTemplate>
<tr>
<td>
<div class="container">
<div class="row">
<div class="col-sm-3 col-xs-12">
<p><asp:Label runat="server" ID="lblName" Enabled="false" Font-Bold="true" Font-Size="X-Large" Text='<%# Bind("Name") %>'/></p>
</div>
</div>
</td>
</tr>
There is no full answer to this question other than to point you in the right direction to help yourself.
Tables should be used to display tabular data. They shouldn't be used for full site layout which is what you are essentially doing. One of the main selling points to bootstrap CSS is that it has already fleshed out flexible building blocks for you to use. I'm assuming this is a school project? Challenge yourself to build the layout without tabular structure using divs and the bootsrap classes (containers, rows, cols). With the current site it looks like you are missing the point of bootstrap all togather.
If you are attempting to eliminate white space, stop stacking containers inside of containers inside of containers. Each one of these elements has their own padding and margin values so every time you do this, you are fighting against yourself even more.
For Example, your first table is full of unnecessary elements that are fighting against what you are trying to do.
You:
<table>
<tbody><tr>
<td>
<div class="container">
<div class="row">
<div class="jumbotron">
<div class="container">
<img class="img-responsive col-lg-12 col-md-12 col-sm-12 col-xs-20" src="Images/JoCoGoBanner.png">
</div>
</div>
</div>
</div>
</td>
</tr>
</tbody></table>
Clean div with flexible layout using bootstrap:
<div class="jumbotron p-0"><img class="img-responsive col-lg-12 p-0" src="Images/JoCoGoBanner.png"></div>
Break free from tabular layout thinking or you will always be fighting against yourself dealing with flexible layout requirements.
I have a page where i am displaying videos with their title above them. I am currently using a Repeater which renders out a div with the video title and a div with the video iframe html. Everything is coming from a database table where i store the video title and video iframe html.
<asp:Repeater ID="RptVideos" runat="server" OnItemDataBound="RptVideos_ItemDataBound">
<ItemTemplate>
<div class="TrainingVideosVideoContainer">
<div class="Title">
<asp:Label ID="LblVideoTitle" runat="server" />
</div>
<div class="Video">
<asp:Literal ID="LitYoutubeVideo" runat="server" />
</div>
</div>
</ItemTemplate>
My problem being this renders them out one below the other in a list format. I wish to render my videos out in almost a grid format, so two side by side etc. How is best to go about this? HTML Rendering? Repeater? GridVIew?
I found that #Crowcoder was correct in this suggestion to use a DataList control. With this i was able to specify the layout being in a table format with the RepeatColumns being set to 2
<asp:DataList ID="DltVideos" runat="server" OnItemDataBound="DltVideos_ItemDataBound"
RepeatColumns="2" RepeatLayout="Table" Width="100%">
<ItemTemplate>
<div class="TrainingVideosVideoContainer">
<div class="Title">
<asp:Label ID="LblVideoTitle" runat="server" />
</div>
<div class="Video">
<asp:Literal ID="LitYoutubeVideo" runat="server" />
</div>
</div>
</ItemTemplate>
</asp:DataList>
<asp:UpdatePanel runat="server"><ContentTemplate>
<asp:UpdatePanel ID="PanelImportFileForCSV" Visible="false" runat="server">
<ContentTemplate>
<div class="form-group" runat="server">
<label for="textfield" class="control-label col-sm-4">CSV File<span class="ErrorMessage" style="color: red;"> *</span>/label>
<div class="col-sm-8">
<asp:FileUpload runat="server" ID="FileUpload2" /> <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator2" ControlToValidate="FileUpload1" ForeColor="DarkRed" ErrorMessage="Only (.mpp) File is allowed" ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))(.csv|.CSV)$" />
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate
</asp:UpdatePanel>
<div class="row">
<div class="col-sm-12">
<div class="form-actions">
<asp:button id="btnProceed" runat="server" CssClass="btn" ToolTip="Cancel" Text="Proceed" OnClick="btnProceed_Click" CausesValidation="False"></asp:button>
</div>
</div>
</div>
I know I should use trigger for Full postback for file upload, but i have multiple updatepanels and that idea is not working anymore!
Kindly Help me
Nvm i have fixed the issue by adding the following line in page_Load()
Page.Form.Attributes.Add("enctype", "multipart/form-data")
I have a webform with two upload controls and a number of textfields.
When the button is pressed the files get uploaded and then get processed.
The upload takes no time, but the processing does.
I know I can't have an upload control in an update panel, so I can't work out how to use the update progress control to show my progress.
My page with an updateprogress control that does work is as follows:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1" DynamicLayout="true">
<ProgressTemplate>
<div class="LOADING">
Your data is being processed<br />
<br />
<img src="/images/loading.gif" /><br />
<br />
Please wait...
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<div class="addFixture">
<asp:ValidationSummary ID="ValidationSummary1" ValidationGroup="fixture" runat="server" />
<label>
Type
<asp:DropDownList ID="ddlType" runat="server" AppendDataBoundItems="true">
<asp:ListItem Text=""></asp:ListItem>
</asp:DropDownList>
<label>
Date
</label>
<asp:TextBox ID="txtDate" runat="server"></asp:TextBox>
<label>
Name 1</label>
<asp:TextBox ID="txtName1" runat="server"></asp:TextBox>
<label>
Name 2
<asp:TextBox ID="txtName2" runat="server"></asp:TextBox>
<label>
First XML File</label>
<asp:FileUpload ID="firstFileUp" runat="server" />
<br />
<label>
Second Xml File</label>
<asp:FileUpload ID="secondFileUp" runat="server" />
<br />
<br />
<asp:Button ID="SubmitButton" runat="server" CausesValidation="true" Text="Submit" OnClick="SubmitButton_Click" />
<asp:Label ID="ErrorMessageLabel" runat="server" EnableTheming="false"></asp:Label>
</div>
</ContentTemplate>
</asp:UpdatePanel>
I have searched for this, but people seem to be trying to get the progress of the file upload and not the processing.
Can anyone help?
Remove the UpdatePanel as all the way you can't use FileUpload controls inside it.
Add to the SubmitButton OnClientClick property with following value: OnClientClick="showProgress()"
Also add onto the page javascript function below:
function showProgress() {
var updateProgress = $get("<%= UpdateProgress1.ClientID %>");
updateProgress.style.display = "block";
}
By the way, consider to use some async file upload control like one from the Ajax Control Toolkit library
You can use an UpdatePanel and the FileUpload if you use the ASyncFileUploadControl. It works pretty well. Make sure you download the latest version because there were a couple of issues with prior releases.