I am using asp.net CreateUserWizard to create a portal web site. The interface pages like below:
In the last step, I have a link to a pdf file. What I want is by clicking it, a pdf file will be opened. However it failed, it always go to the first screen(login web page).
The corresponding code of the last step:
<asp:CompleteWizardStep runat="server" ID="CompleteWizardStep">
<ContentTemplate>
<table style="font-family: Verdana; font-size: 100%;">
<tr>
<td align="center" class="style5" style="color: White; background-color: #5D7B9D;
font-weight: bold;">
Complete
</td>
</tr>
<tr>
<td class="style1">
Your account request was successfully submitted. Please download the
form and return it. You shoud receive an email response within 3 business days.
Thank you.
</td>
</tr>
<tr>
<td align="right" class="style1">
<asp:Button ID="ContinueButton" runat="server" BackColor="#FFFBFF" BorderColor="#CCCCCC"
BorderStyle="Solid" BorderWidth="1px" CausesValidation="False" CommandName="Continue"
Font-Names="Verdana" ForeColor="#284775" Text="Download Form" ValidationGroup="CreateUserWizard1"
PostBackUrl="~/admin/DownloadFile.aspx" />
</td>
</tr>
</table>
</ContentTemplate>
You see the code doesn't work at all.
Also PostBackUrl="~/admin/DownloadFile.aspx" is also not working, it is also going to login page. I heard that we enable Javascript something. But how to change my code since it is not in the code behind.
Many thanks.
It seems the ~/Admin/DownloadFile.aspx is protected and the user has no permission to access this file or Admin location as a whole.
You can put your DownLoadFile.aspx in unrestricted area
Related
There is something strange happening here. I currently have a drop down drpIntervention that has autopostback="true" and up until now I was calling server code, to disable/enable controls depending on what the selected value is. I'm not likeing the flickering with postbacks so I'm trying to wrap the code in UpdatePanel with AsyncPostBack Trigger but strange things are happening:
This is what code looks like for this update panl:
<asp:UpdatePanel ID="UpdatePanel5" runat ="server" UpdateMode ="Conditional">
<ContentTemplate >
<tr>
<td colspan="3" class="questionFont">
<table style="width:100%; border-collapse:collapse ">
<tr>
<td>
<b>a. What is the Problem?</b>
</td>
<td >
<asp:DropDownList ID="drpCrisisType" runat="server" autopostback="true" Enabled ="false" OnSelectedIndexChanged="drpCrisisType_SelectedIndexChanged ">
</asp:DropDownList>
<span runat="server" style="font-size:12px; font-family :'Times New Roman';" ID="Span16"><i>(Description)</i></span>
</td>
</tr>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="drpIntervention" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
and this is code for the button that's supposed to trigger the Event, which is outside the updatePanel
<tr>
<td class="questionFont" style="padding-top: 20px">
<b>4. Did you engage in any?</b>
</td>
<td style="padding-top: 20px">
<asp:DropDownList ID="drpIntervention" runat="server" autopostback="true" OnSelectedIndexChanged="drpIntervention_SelectedIndexChanged ">
</asp:DropDownList>
</td>
</tr>
So this is not my entire code, the <tr> belongs to a table, that has many more above it, this update panel and drop down are just a part of it. What's happening is, I load the page in browser and everything looks good, then I select a value in drpIntervention and the content (other dropdowns, and textboxes that have server code for enabling/disabling) that is wrapped in update panel gets moved above other content in the page. Even stranger, is that the content that gets moved works correctly without doing the postback, however the content is also in its original place and it doesn't work there.
I hope I'm making sense, the content in update panel is literally in 2 places on the page as soon as I select a value from drpIntervention. Mind blown!
I believe the issue had to do with where I was putting the asp:update panel. Since I was putting it inside the table, it was somehow was overriding the formatting and bringing the content within the update panel to top of the the table.
What solved the issue is when I created a table for this questions, and wrapped the entire table with the asp:update panel. This resolved the issues
i need your help.
I have an home button (it exactly is ) in masterpage use for all aspx. Pages is my folder name (it containts my aspx webpages) and it has an "Admin" folder inside (it containts my admin page). It works in all of pages except admin page. when I clicked "Home" from admin page I got "The resource cannot be found." error, and the Url in web browser's address bar is "localhost/Pages/Pages/Home"
I don't know why i get two "Pages" in the Url.
help me please
table>
<tr>
<td width="700px">
<ul class="menu">
<li>Trang chủ </li>
<li class="Parent">Sản Phẩm
<ul>
<li>Điện thoại </li>
<li>Máy tính bảng </li>
<li>Phụ kiện </li>
</ul>
</li>
<li>Giới thiệu </li>
<li>Góp Ý </li>
<li>Đăng nhập </li>
<li>Đăng kí</li>
</ul>
</td>
<td width="300px">
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<asp:Label ID="lblUser" runat="server" Font-Bold="True" ForeColor="White"></asp:Label>
</td>
<td>
<asp:HyperLink ID="HyperQuantri" runat="server" Font-Bold="True" ForeColor="White"
NavigateUrl="~/HienThi/ThongTin.aspx">Thông tin</asp:HyperLink>
</td>
<td>
<asp:HyperLink ID="HyperThoat" runat="server" Font-Bold="True" ForeColor="White"
Visible="False" NavigateUrl="~/HienThi/Thoat.aspx">Thoát</asp:HyperLink>
</td>
</tr>
</table>
</td>
</tr>
It sounds like you may have some relative pathing issues with your links. This gets particularly tricky when you're using master/child pages or template controls in a site where you have various depths of folders.
Since you're using web controls, try renaming your links using the following format:
~/Pages/Admin/Default.aspx
The ~/ directive will tell ASP.Net to build the path of the link from the root of the site, so no matter which page the control resides on, it will generate the proper link.
I have an ASP.NET 4.0 web application where users upload videos to the server. I have a FileUpload control and 2 DropDownLists.
The user first selects a video to be uploaded from the FileUploadcontrol after that s/he selects a category from DropDownList1 (category list). After the user selects a category, I fill the second DropDownList with subcategories.
When I select a file to upload, and select a category from the DropDownList, the page disconnects from the server after postback. If I do the same scenario without selecting a file to be uploaded, I succesfully fill the second combo.
Here is my code :
<tr>
<td style="text-align: left;" class="style9" colspan="2">
<asp:Label ID="Label1" runat="server" Text="Video" Width="80px"></asp:Label>
<asp:FileUpload ID="FileUploadVideo" runat="server" ViewStateMode="Enabled" />
</td>
<td style="text-align: left;" class="style4">
<asp:Label ID="Label3" runat="server" Text="Category" Width="80px"></asp:Label>
<br />
<asp:DropDownList ID="cmbCategory" runat="server" AutoPostBack="True" OnSelectedIndexChanged="cmbCategory_SelectedIndexChanged">
</asp:DropDownList>
</td>
<td style="text-align: right;">
<asp:Label ID="Label6" runat="server" Text="Subcategory" Width="80px"></asp:Label>
<br />
<asp:DropDownList ID="cmbSubcategory" runat="server">
</asp:DropDownList>
</td>
</tr>
Any help would be appreciated.
Since you're uploading video, I imagine this is erroring out due to the file size. The default max file size for ASP.NET applications is 4MB. You can add something like this to the <system.web> section of your web.config to increase that deault:
<system.web>
<httpRuntime executionTimeout="240" maxRequestLength="20480" />
</system.web>
This allows, for instance, for a 20MB file to be uploaded.
For more information check out this article: Large file uploads in ASP.NET
I have a asp.net page, the main content section displays the custom html content from the database. To the right of it, it has a few user control that lets the user make drop down selections and go to its perspective links.
So it's something like this:
<asp:Content ID="Content3" ContentPlaceHolderID="mainContentPlaceHolder" Runat="Server">
<atlas:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server" />
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td valign="top">
<%=Session["xyz"].ToString()%>
</td>
</tr>
</table>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="rightContentPlaceHolder" Runat="Server">
<table cellpadding="0" cellspacing="0" border="0" style="margin-left: 4px;">
<tr>
<td style="width: 239px;">
<uc18:x ID="x1" runat="server" referer="Home" />
<uc17:y ID="y1" runat="server" />
<uc4:z ID="z1" runat="server" />
</td>
</tr>
</table>
</asp:Content>
The user contorls are pretty straight forward. Each one of them has drop downs. If one selects, it populates the next one..etc, and they are wrapped around a update panel so the page won't referesh itself on selection.
The issue i have is when the page first loaded, the content in <%=Session["xyz"].ToString()%>, which sometimes have css inline style, loads fine. However as soon as the user clicks on the first drop down of any user control, the css inline style disappears.
My question is why is the inline style not being rendered by the browser again on ajax postback (only happening in IE, firefox is ok)? What should i do about this?
Thanks in advance.
Angela.
It turns out that there's bug with Atlas. If i use the asp.net ajax, it works fine. Unfortunately i cannot change Atals ajas to asp.net for the time being. My easiest solution was to let the full post back happen.
When using asp:login, asp:forgotpassword and asp:createuserwizard controls within an ascx. (e.g registration.ascx) it can't find e.g UserName, even though it exists within LayoutTemplate. Any idea how to fix this?
If you open smart tag for control in design mode,you shall see that there are steps that can be convertible to templates for customization.
CreateUserWizard http://img197.imageshack.us/img197/3823/7d4df5a594a1abdb8fdc8f1.png
For CreateUserWizard , press Customize Create User Step and you will observe that,control is converted into a table template which you can see how controls named i.e. UserName,Password...
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server">
<WizardSteps>
<asp:CreateUserWizardStep runat="server" ID="CreateUserWizardStep1">
<ContentTemplate>
<table border="0">
<tr>
<td align="center" colspan="2">
Sign Up for Your New Account</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label>
</td>
<td>
<asp:TextBox ID="UserName" runat="server"></asp:TextBox>
.......
Also know that If you wish to find control from inner templates , you must look for templates with FindControl method to reach the control you desire.
To Find UserName Control in above code,use
CreateUserWizardStep1.TemplateControl.FindControl("UserName") as TextBox
Hope this helps to solve your problem