I want to get text value of my label from user control in my aspx page to make it null.How to I access that . I tried that but this is not working
I have a pane in which user control is present
<%# Register Src="~/General/Setup/UserControl/Branch.ascx" TagName="Branch" TagPrefix="uc1" %>
<asp:Panel ID="pnlBranchAdd" runat="server" Width="60%">
<div class="lgbx">
<div class="bx_bor">
<div id="divClose" align="right" style="height: 6px;z-index:-1;" >
<asp:ImageButton runat="server" ID="Close" ImageUrl="../../Images/icn_close2.png"
CssClass=style3 onclick="Close_Click" Height="34px" Width="36px" />
</div>
<div class="content">
<h2>
<strong>Branch</strong></h2>
<uc1:Branch ID="Branch" runat="server" />
</div>
</div>
</div>
</asp:Panel>
Need help
thanks.
Hope this work
Label lbl = (Label)Branch.FindControl("LabelID");
Related
I have the task of modifying some already developed web app's aspx pages. Those pages Needs to be converted to use the new Bootstrap layout. So what is meant by bootstrapping page? one of the pages is below. Please give me some idea.
<%# Page Language="VB" MasterPageFile="~/MasterExternal.master" AutoEventWireup="false" CodeFile="OptIt.aspx.vb" Inherits="OptIt" %>
<%# MasterType VirtualPath="~/MasterExternal.master" %>
<asp:Content ID="c2" ContentPlaceHolderID="cpStyle" Runat="Server">
<style type="text/css">
#middleContentContentParent {position:relative;left:50px;width:900px;}
.dtText {font-size:22px;height:35px;line-height:35px;width:50px}
input[type=text] {padding:0;}
</style>
</asp:Content>
<asp:Content ID="c3" ContentPlaceHolderID="cp3" Runat="Server">
<form runat="server" id="aspnet">
<div style="position:relative;width:860px;height:450px;margin:0 20px 0 20px">
<h1>Opt-In to TXT Messaging</h1>
<hr />
<div style="text-align:left;" >
<div runat="server" id="divFields">
<p>
Enter your cell phone noted in the email you just received to receive your TXT confirmation. Then follow the directions in the TXT message.
</p>
<br />
<div style="width:360px;margin:0 auto;text-align:center">
<asp:ValidationSummary class="valSummaryLg" ID="valSummary" runat="server" />
<h4>Mobile Number</h4>
<p style="text-align:left">
(<input runat="server" type="text" size="3" class="dtText" maxlength="3" id="CellPhone1_1" value="" /> ) <input class="dtText" runat="server" type="text" maxlength="3" size="3" id="CellPhone1_2" value="" /> - <input runat="server" type="text" maxlength="4" size="4" id="CellPhone1_3" class="dtText" value="" />
<asp:CustomValidator runat="server" ID="valPhone" Text="*"></asp:CustomValidator>
<br />
<br />
<asp:Button runat="server" CssClass="button1Lg" ID="btnSubmit" Text="Submit" />
</p>
</div>
</div>
<div runat="server" id="lblMessage" visible="false">
<br /><br />
<h2>Almost done... </h2>
<p>
Follow the instructions in the TXT you just received. If you don't receive a TXT confirmation message, please see the "Commons Problems" below.
</p>
<br /><br />
<h4>Common Problems with TXTing (using SHORT CODES):</h4>
<p>
FFPS uses a 5 digit "short code" to send TXT messages. Short codes are used for businesses to ensure the sender is respecting the recipient's TXTing preferences. Some carriers (like Sprint) require individuals to call and UNBLOCK SHORT CODES. Some of the common problems with receiving FFPS TXT messages include:
</p>
<div style="margin:0 0 0 20px">
<h5>You are using Wal-Mart Family Mobile</h5>
<p><b>How to Fix:</b> Sorry, Wal-Mart does not support TXTing with Short Codes</p>
<h5>You are using Sprint and they have blocked Short Codes</h5>
<p><b>How to Fix:</b> Call Sprint and request to "Unblock Short Codes"</p>
</div>
</div>
</div>
</div>
</form>
</asp:Content>
This is an answer for my own question. I have changed this to use bootstrap. I have added row classes for every row. Please have a look and give some ideas.
<%# Page Language="VB" MasterPageFile="~/MasterExternal.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="Scholarship_Default" %>
<%# MasterType VirtualPath="~/MasterExternal.master" %>
<asp:Content ID="c2" ContentPlaceHolderID="cpStyle" Runat="Server">
<%--<style type="text/css">
#middleContentContentParent {position:relative;left:50px;width:860px;}
#divDownloadForms img {vertical-align:middle}
</style>--%>
</asp:Content>
<asp:Content ID="c3" ContentPlaceHolderID="cp2" Runat="Server">
<%--<div style="position:relative;width:820px;height:400px;margin:0 auto;">--%>
<div>
<div class="row">
<h1>Scholarship Form</h1>
</div>
<div class="row">
<h2>Instructions</h2>
</div>
<div class="row">
In order to apply for a scholarship, you will need to complete the Scholarship/Signup forms. Please mail the 4 page form by the deadline stated below (otherwise, may cause delays or prevent placement). Detailed instructions and the mailing address are found on the form (link below).<br />
</div>
<div class="row">
<h2>Form Deadline</h2>
</div>
<div id="divDownloadForms">
<div class="row">
For
<b><asp:Label runat="server" ID="lblSeason"></asp:Label></b>,
FFPS must receive your scholarship form by <b><asp:Label runat="server" ID="lblDate"></asp:Label></b>.
</div>
<div class="row">
<h5>Download the Scholarship/Signup Form - High Resolution (pdf)</h5>
</div>
<div class="row">
<img src="../images/icons/attach.gif" alt="" /> Download File
</div>
</div>
</div>
</asp:Content>
Sham, If you can show the existing design, then I can help you. You need to add column grid in between row's for suitably viewing in all view-ports.
It's my Repeater:
<asp:Repeater ID="RepeaterWeb" runat="server">
<ItemTemplate>
<div class="productWrapper">
<div class="productWrapperImage"><img src="prdimg/<%# Trim(Eval("ProductImage")).ToString()%>" /></div>
<div class="fontTrebuchet"><%# Trim(Eval("ProductShortInfo")).ToString()%></div>
<h3 class="fontUbuntu productBoxName"><%# Trim(Eval("ProductName")).ToString()%></h3>
</div>
<!--This div my problem--><div class="verticalProductsSpacer"></div>
</ItemTemplate>
</asp:Repeater>
I feed the Repeater with 4 rows of data from database, first three <div class="verticalProductsSpacer"></div> are necessary but the last one shouldn't be existed. How can I do it?
User a SeparatorTemplate:
<asp:Repeater ID="RepeaterWeb" runat="server">
<ItemTemplate>
<div class="productWrapper">
<div class="productWrapperImage"><img src="prdimg/<%# Trim(Eval("ProductImage")).ToString()%>" /></div>
<div class="fontTrebuchet"><%# Trim(Eval("ProductShortInfo")).ToString()%></div>
<h3 class="fontUbuntu productBoxName"><%# Trim(Eval("ProductName")).ToString()%></h3>
</ItemTemplate>
<SeparatorTemplate>
<div class="verticalProductsSpacer"></div>
</SeparatorTemplate>
</asp:Repeater>
You can use Jquery to hide it.
$('.verticalProductsSpacer').last().css('display', 'none');
I have an ASP.NET 3.5 form with several fields and a sub form inside a ModalPopup. The problem I'm having is with a RequiredFieldValidator inside the ModalPopup. For some reason it is preventing post back inside the ModalPopup. Both the validator and the submit buttons have the same ValidationGroup that is unique to them. Here is the markup for the sub form:
<%# Control Language="C#" AutoEventWireup="true" CodeFile="RoomBuilder.ascx.cs" Inherits="Admin_Controls_RoomBuilder" %>
<link href="../../../../style/FlexStyle.css" rel="stylesheet" type="text/css" id="style"
runat="server" visible="false" />
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div class="form" style="width: 420px; height: 500px; padding: 3px; position: relative;
text-align: center;">
<div style="width: 280px">
<div class="item smalltitle ">
Title:
</div>
<div class="item">
<asp:TextBox ID="txtTitle" runat="server" Width="250px"></asp:TextBox>
</div>
<div class="item smalltitle gapontop">
Description:
</div>
<div class="item">
<asp:TextBox ID="txtDesc" runat="server" Width="250px" Height="40px" TextMode="MultiLine"></asp:TextBox>
</div>
<div class="item gapontop">
<div class="smalltitle floatLeft" style="width: 120px;">
Room Number
</div>
<div class="smalltitle floatLeft" style="width: 120px;">
Phone
</div>
</div>
<div class="item">
<div class="floatLeft" style="width: 120px;">
<asp:TextBox ID="txtRoomNo" runat="server" Width="100px"></asp:TextBox>
</div>
<div class="floatLeft" style="width: 120px;">
<asp:TextBox ID="txtPhone" runat="server" Width="100px"></asp:TextBox>
</div>
</div>
<div class="item smalltitle gapontop ">
Type:
</div>
<div class="item">
<asp:TextBox ID="txtType" runat="server" Width="250px"></asp:TextBox>
</div>
<div class="item smalltitle gapontop ">
Number of Seats:
<asp:RequiredFieldValidator ID="RequiredFieldValidatortxtNoSeats" runat="server" ErrorMessage="*"
ControlToValidate="txtNoSeats" ValidationGroup="roomVal"></asp:RequiredFieldValidator>
</div>
<div class="item">
<asp:TextBox ID="txtNoSeats" runat="server" Width="50px"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Not a number"
ControlToValidate="txtNoSeats" ValidationGroup="roomVal" ValidationExpression="[0-9]*"></asp:RegularExpressionValidator>
</div>
</div>
<!-- ************************************ -->
<div class="topBorder" style="width: 100%; height: 35px; position: absolute; bottom: -8px;
right: 2px; text-align: right; padding-top: 11px;">
<asp:Button ID="btnCancel" runat="server" CssClass="button" Text="Cancel" CausesValidation="false"
OnClick="btnCancel_Click" ValidationGroup="roomVal" />
<asp:Button ID="btnSave" runat="server" CssClass="button" Text="Save" OnClick="btnSave_Click" CausesValidation="true" ValidationGroup="roomVal" />
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
When the validator is removed (or CausesValidation is set to false), the sub form posts. RegularExpressionValidators don't have this problem. I've run FireBug, but I'm not seeing any obvious errors.
Is there something I'm missing?
Oh my god I'm so stupid!! >:(
Found the reason for the problem. There was another copy of the same control nested inside another control. And (of course) having the same ValidationGroup name as my first control all Required Field Validators fail to work!
Argh! Candidate for a Daily WTF!
Sorry to have wasted everybody's time :(
Can you please check if your Button (or some other control) that open the popup and the modaldialog extender are outside the update panel?
I got strange problems with modalpopup too. I would suggest you to try something different, for example a numericupdown control from the ajaxcontroltoolkit, if you already use it. So you don't need any validator for this.
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<div class="item smalltitle gapontop ">
Number of Seats:
</div>
<div class="item">
<asp:TextBox ID="txtNoSeats" runat="server" Width="50px"></asp:TextBox>
<cc1:NumericUpDownExtender ID="txtNoSeatsExt" runat="server"
Enabled="true" Minimum="1" Maximum="100" TargetControlID="txtNoSeats" Width="50" />
</div>
I'm using the Ajax Control Toolkit with .NET in VS2008 to put a Rating control on my page. I've got the scriptmanager on the page and the rating control works in Chrome and IE but not Firefox. In Firefox it gives me this error "this._form is null". I've got no other scripts included on the page. There are a couple included in the master page but they are closed with </script>. I've tried using ToolkitScriptManager but it hasn't changed anything.
<form id="aspnetForm" runat="server"><ajaxToolkit:ToolkitScriptManager id="ScriptManager1" runat="server" EnableScriptGlobalization="true" EnableScriptLocalization="true" EnablePartialRendering="true" SupportsPartialRendering="true" />
<div id="main" align='center'>
<div id="inside">
<div id="nav">
<div id="photoCount"><label id="lblPhotoCount" runat="server"></label></div>
<div id="photoNav">
<a class="nav_a" runat="server" id="previouslink" href="">Previous</a><a class="nav_a" runat="server" id="nextlink" href="">Next</a>
</div>
<div class="clear"></div>
</div>
<div id="divBrowseBox" runat="server">
<div id='divPicHeader' runat='server' style="z-index: 2998">
</div>
</div>
<div id="likeArea">
<iframe id="likeIframe" runat="server" src="" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:250px; height:80px;" allowTransparency="true"></iframe>
</div>
<div id="ratingArea">
<asp:updatepanel id="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:HiddenField ID="hdnCurrentPhotoID" runat="server" />
<asp:HiddenField ID="hdnCurrentRating" runat="server" />
<asp:HiddenField ID="hdnAvgRating" runat="server" />
<asp:HiddenField ID="hdnTotalVotes" runat="server" />
<asp:HiddenField ID="hdnAddRating" runat="server" />
<asp:Label ID="lblYourVote" runat="server" Font-Size="12px" Text="Rate This Photo!"></asp:Label>
<div id="starbox">
<div id="stars">
<ajaxToolkit:Rating ID="Rating1" runat="server"
CurrentRating="3"
MaxRating="5"
StarCssClass="ratingStar"
WaitingStarCssClass="savedRatingStar"
FilledStarCssClass="filledRatingStar"
EmptyStarCssClass="emptyRatingStar"
OnChanged="Rating1_Changed"
AutoPostBack="true"
BehaviorID="rbid"
>
</ajaxToolkit:Rating>
</div>
</div>
<div style="clear: both;"></div>
<asp:Label ID="lblTotalVotes" runat="server" Font-Size="10px" Text=""></asp:Label>
</ContentTemplate>
</asp:updatepanel>
</div>
<div style="clear: both;"></div>
</div>
</div>
</form>
Updated with code. There are only some styles above the form and that is all.
I answered my own question. I was trying to create a form within a form and it wasn't working. I didn't get any indication of that from the error messages but eventually figured it out.
Is there any way to change the default layout for Wizard Control?
There are a bunch of templates that come with various parts, such as the headertemplate, and various navigation templates that allow you to customise it to a certain extent.
http://msdn.microsoft.com/en-us/library/fs0za4w6.aspx
I suppose it depends on what you want to do.
Place the following <LayoutTemplate> tag inside of your <asp:Wizard> tag.
<asp:Wizard ...>
<LayoutTemplate>
<div class="headPlaceHolder">
<asp:PlaceHolder ID="headerPlaceHolder" runat="server" />
</div>
<div class="sidePlaceHolder">
<asp:PlaceHolder ID="sideBarPlaceHolder" runat="server" />
</div>
<div class="stepPlaceHolder">
<asp:PlaceHolder ID="WizardStepPlaceHolder" runat="server" />
</div>
<div class="navPlaceHolder">
<asp:PlaceHolder ID="navigationPlaceHolder" runat="server" />
</div>
</LayoutTemplate>
...
...
</asp:Wizard>
Source: http://msdn.microsoft.com/en-us/library/fs0za4w6.aspx