I am trying to put a Label control within a panel control. the panel control is supposed to enable the user scroll down when the label content grows bigger than the panel capacity.
<%# Page Language="C#" AutoEventWireup="true" CodeFile="EventReviewPage.aspx.cs"
Inherits="EventReviewPage" %>
<!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">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Event Log: "></asp:Label>
</td>
<td>
<asp:TextBox ID="txtLog" runat="server"></asp:TextBox>
</td>
<td>
<asp:CheckBox ID="chkAll" runat="server" OnCheckedChanged="chkAll_CheckedChanged"
AutoPostBack="True" />
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="Source: "></asp:Label>
</td>
<td>
<asp:TextBox ID="txtSource" runat="server"></asp:TextBox>
</td>
</tr>
</table>
</div>
<div>
<asp:Button ID="cmdGet" runat="server" Text="Get Records" OnClick="cmdGet_Click" />
</div>
<asp:Panel ID="Panel1" runat="server" BorderStyle="None" ScrollBars="Vertical">
<asp:Label ID="lblResult" runat="server" Text=""></asp:Label>
</asp:Panel>
</form>
</body>
</html>
The asp:Panel warps the text with a div, but you do not have specify a height for this panel, so their height is always fit the height of your data, and thats why you do not see scroll bar for that div.
If you set both height and width you see the scroll bar.
For example
<asp:Panel ID="Panel1" runat="server" BorderStyle="None"
ScrollBars="Vertical" Height="80px" Width="180px">
Related
I have created an .aspx page. The page contains one panel and within the panel, two update panels (right panel, left panel). In side the left update panel are two div tags, one representing the top half of the left update panel and the other div representing the bottom of the left update panel. It is the same with the right update panel. The bottom div in the left update panel has a Gridview.
I want to add a single (no-repeat) background image to the entire panel, so that the background image covers the whole of the panel area. When I add a background image to the panel, it only covers the top-left update panel and the top-right update panel, thereby leaving the bottom part of both update panels bare.
I have also used user controls to represent the Header, Left Navigation panel and the Right sliding panel. But I don't want the background image to be applied to the header or the two side panels, just the center panel.
I tried giving BackgroundImageURL to the panel, as well as, using CssClass attribute to link to a css class including the background image.
Here's my code (.aspx) :
<body>
<Header:main runat="server" ID="header"></Header:main>
<Leftpnl:left runat="server" ID="pnlLeft"></Leftpnl:left>
<RightPnl:right runat="server" ID="pnlRight"></RightPnl:right>
<div class="Title">
<h2>Tickets</h2>
<hr class="Sub_Title_HR" />
</div>
<form runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Panel ID="Pnl_New_First" runat="server">
<div class="Sub_Heading">
<asp:Label ID="Sub_1" runat="server" Text="Plan Your Trip"></asp:Label>
</div>
<asp:Panel ID="Panel_1" runat="server" CssClass="Pnl_BG">
<div class="New_Left">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table>
<tr>
<td class="Cell_Size">
<asp:Label ID="New_Dep_Title" runat="server" Text="Departure"></asp:Label>
</td>
<td class="Cell_Size">
<asp:Label ID="New_Arr_Title" runat="server" Text="Arrival"></asp:Label>
</td>
<td class="Cell_Size">
<asp:Label ID="New_Date_Title" runat="server" Text="Date"></asp:Label>
</td>
</tr>
<tr>
<td class="Cell_Size">
<asp:DropDownList ID="New_Dep_DDL" CssClass="DDL" runat="server">
<asp:ListItem>IND</asp:ListItem>
<asp:ListItem>KUL</asp:ListItem>
</asp:DropDownList>
</td>
<td class="Cell_Size">
<asp:DropDownList ID="New_Arr_DDL" CssClass="DDL" runat="server">
<asp:ListItem>CMB</asp:ListItem>
<asp:ListItem>KUL</asp:ListItem>
</asp:DropDownList>
</td>
<td>
<telerik:RadDatePicker ID="New_Date1" Skin="Default" runat="server" DateInput-DateFormat="dd-MMM-yyyy" style="margin-left: 0px">
</telerik:RadDatePicker>
</td>
<td>
<asp:Button ID="New_Search" runat="server" Text="Search" />
</td>
</tr>
<br /><br />
</table>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<table id="UL_Outbound_Tab">
<tr>
<td id="New_Outbound_Head">Outbound : <asp:Label ID="Dep_Airport" runat="server" Text=""></asp:Label> To <asp:Label ID="Arr_Airport" runat="server" Text=""></asp:Label>
</td>
</tr>
<asp:GridView ID="New_Outbound_Grid" runat="server">
</asp:GridView>
<tr>
<td>
<asp:Button ID="New_Add" runat="server" Text="Add" />
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="New_Right">
<asp:UpdatePanel ID="UpdatePanel3" runat="server">
<ContentTemplate>
<asp:Label ID="New_My_Trip_Head" runat="server" Text="My Trip"></asp:Label>
<table id="New_My_Trip_Tab">
<asp:GridView ID="My_Trip_Grid" runat="server">
</asp:GridView>
</table>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel4" runat="server">
<ContentTemplate>
<asp:Label ID="New_Tick_Val_Head" runat="server" Text="Ticket Validity Period"></asp:Label>
<table id="New_Tick_Val_Tab">
<tr>
<td>
<asp:Label ID="Val_From" runat="server" Text="Valid From : "></asp:Label>
</td>
<td>
<telerik:RadDatePicker ID="Val_From_Date" Skin="Default" runat="server" DateInput-DateFormat="dd-MMM-yyyy" style="margin-left: 0px"></telerik:RadDatePicker>
</td>
<td style="width: 100%">
<asp:Label ID="Val_To" runat="server" Text="Valid To : "></asp:Label>
</td>
<td>
<telerik:RadDatePicker ID="Val_To_Date" Skin="Default" runat="server" DateInput-DateFormat="dd-MMM-yyyy" style="margin-left: 0px"></telerik:RadDatePicker>
</td>
</tr>
<caption>
<tr style="margin-top: 5%">
<td style="width: 35%">
<asp:Label ID="Val_Com" runat="server" Text="User Comments : "></asp:Label>
</td>
<td>
<asp:TextBox ID="Val_Com_Txt" runat="server" Rows="5" TextMode="MultiLine" style="width: 150%; resize: none" placeholder="Text Here"></asp:TextBox>
</td>
</tr>
</caption>
</table>
<asp:ImageButton class="next1 Left_Right_Controls" runat="server" OnClientClick="next1()" ImageUrl="~/Images/Buttons/page_right_arrow.png" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:panel>
<div id="step_init" class="Steps">
<img src="Images/Steps/1.png" alt="" />
</div>
</asp:Panel>
</form>
</body>
Here's my CSS :
.Pnl_BG {
background-image: url(../Images/travelling.jpg);
background-size:100% 100%;
background-repeat: no-repeat;
}
Please help...
If normal table means I got output otherwise how do i get it? My aspx page:
<%# Page Title="" Language="VB" MasterPageFile="~/UserRegistration.master" AutoEventWireup="false"
CodeFile="Default.aspx.vb" Inherits="_Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js" type="text/javascript"></script>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="Stylesheet" type="text/css" />
<script type="text/javascript">
$(function() {
$("[id$=txtdate]").datepicker({
showOn: 'button',
buttonImageOnly: true,
buttonImage: 'image/datepicker2.jpg'
});
});
</script>
<br />
<br />
<div align="center">
<asp:Label ID="label2" CssClass="label" runat="server"></asp:Label>
</div>
<div align="center">
<asp:TextBox ID="txtdate" DataFormatString="{0:MM/dd/yyyy}" AutoPostBack="true" runat="server" Width="107px"></asp:TextBox>
</div>
<br />
<br />
<table id="Table1" align="center" border="1" runat="server">
<tr>
<th>
TeamName
</th>
<th>
TeamMember
</th>
</tr>
<tr>
<td>
<asp:Label ID="lbl1" runat="server"> Team A </asp:Label>
</td>
<td>
<asp:CheckBoxList ID="cblbind" runat="server">
<asp:ListItem Text="Sinthu"></asp:ListItem>
<asp:ListItem Text="susi"></asp:ListItem>
<asp:ListItem Text="siva"></asp:ListItem>
</asp:CheckBoxList>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label1" runat="server"> Team B </asp:Label>
</td>
<td>
<asp:CheckBoxList ID="CheckBoxList1" runat="server">
<asp:ListItem Text="kavya"></asp:ListItem>
<asp:ListItem Text="subathra"></asp:ListItem>
<asp:ListItem Text="mani"></asp:ListItem>
<asp:ListItem Text="sunila"></asp:ListItem>
</asp:CheckBoxList>
</td>
</tr>
</table>
<div align="center">
<asp:Button ID="btnSubmit" Text="SUBMIT" runat="server" />
</div>
<br />
<br />
Here I put the values directly so I can get them easily.
If team name values and team member values are in the database it means how i can bind these items using a table? If the listview gridview means using bound event, what can I use in the table and how i can get the required output?
I'm new to ASP.NET and seems I screwed up my Web Form page that is based off of a Master.
It seems I mixed some invalid html codes but can't figure out why.
<%# Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Clips.aspx.cs" Inherits="Clip.Clips" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:EntityDataSource ID="entityDataSource" runat="server" ConnectionString="name=ClipEnt" DefaultContainerName="ClipEnt" EnableDelete="True" EnableFlattening="False" EnableInsert="True" EnableUpdate="True" EntitySetName="Clips" EntityTypeFilter="Clip" OnSelecting="EntityDataSource_Selecting">
</asp:EntityDataSource>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" DataSourceID="entityDataSource">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="True" />
</Columns>
</asp:GridView>
<div>
<h1>Sending Email</h1>
<table>
<tr>
<td>From:</td>
<td>
<asp:TextBox ID="txtFrom" runat="server" Width="250px"></asp:TextBox>
</td>
</tr>
<tr>
<td>From EMail:</td>
<td>
<asp:TextBox ID="txtFromEmail" runat="server" Width="250px"></asp:TextBox>
</td>
</tr>
<tr>
<td>To:</td>
<td>
<asp:TextBox ID="txtTo" runat="server" Width="250px"></asp:TextBox>
</td>
</tr>
<tr>
<td>To Email:</td>
<td>
<asp:TextBox ID="txtToEmail" runat="server" Width="250px"></asp:TextBox>
</td>
</tr>
<tr>
<td>Subject:</td>
<td>
<asp:TextBox ID="txtSubject" runat="server" Width="250px"></asp:TextBox>
</td>
</tr>
<tr>
<td>Message:</td>
<td>
<asp:TextBox ID="txtMessage" runat="server" TextMode="MultiLine" Height="138px"
Width="467px"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<asp:Button ID="btnSend" runat="server" Text="Send Email"
onclick="btnSend_Click" />
</td>
</tr>
</table>
<asp:Label ID="Label1" runat="server" ForeColor="Blue" />
</div>
</form>
</body>
</html>
</asp:Content>
In the masterpage you have something like this:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
You only need to have this stripped markup in the content page. Notice that I have removed DOCTYPE, <html>, <head>, <body> and <form> tags from content page - they will be rendered from Site.Master master page.
<%# Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Clips.aspx.cs" Inherits="Clip.Clips" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:EntityDataSource ID="entityDataSource" runat="server" ConnectionString="name=ClipEnt" DefaultContainerName="ClipEnt" EnableDelete="True" EnableFlattening="False" EnableInsert="True" EnableUpdate="True" EntitySetName="Clips" EntityTypeFilter="Clip" OnSelecting="EntityDataSource_Selecting">
</asp:EntityDataSource>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" DataSourceID="entityDataSource">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="True" />
</Columns>
</asp:GridView>
<div>
<h1>Sending Email</h1>
<table>
<tr>
<td>From:</td>
<td>
<asp:TextBox ID="txtFrom" runat="server" Width="250px"></asp:TextBox>
</td>
</tr>
<tr>
<td>From EMail:</td>
<td>
<asp:TextBox ID="txtFromEmail" runat="server" Width="250px"></asp:TextBox>
</td>
</tr>
<tr>
<td>To:</td>
<td>
<asp:TextBox ID="txtTo" runat="server" Width="250px"></asp:TextBox>
</td>
</tr>
<tr>
<td>To Email:</td>
<td>
<asp:TextBox ID="txtToEmail" runat="server" Width="250px"></asp:TextBox>
</td>
</tr>
<tr>
<td>Subject:</td>
<td>
<asp:TextBox ID="txtSubject" runat="server" Width="250px"></asp:TextBox>
</td>
</tr>
<tr>
<td>Message:</td>
<td>
<asp:TextBox ID="txtMessage" runat="server" TextMode="MultiLine" Height="138px"
Width="467px"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<asp:Button ID="btnSend" runat="server" Text="Send Email"
OnClick="btnSend_Click" />
</td>
</tr>
</table>
<asp:Label ID="Label1" runat="server" ForeColor="Blue" />
</div>
</asp:Content>
Some points to remember when developing an asp.net web site -
asp.net web forms can contain only one form tag with the attribute runat='server'. So, when a web form inherits from a masterpage, it inherits the form tag from the master page. therefore, no need to add a form tag separately to the web form.
Common parts of the page should be placed in the master page, where as changing parts should be placed in the web forms that inherit the master page. Site headers and footers are static to every page. so they should be placed on the master page. contents of the web site changes from page to page. so they should be placed on the web forms that inherit the master page.
Links to common resources, i.e. site style sheets and javascript files should also be placed once in the masterpage. web forms that inherit the masterpage will automatically inherit them.
these are some of the things by following which you can easily develop web forms with master pages.
Below is my markup code which upon compiling gives me the error message.I have searchd for hours in google but cannot help myself.What is the incoorect code in my markup.
I have a cs file for this pagewhich binds data to this listview conrol
Any help to fix this will be greatly helpful
Error Message:An item placeholder must be specified on ListView 'listview1'. Specify an item placeholder by setting a control's ID property to "itemContainer". The item placeholder control must also specify runat="server".
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Attestation2.aspx.cs" Inherits="Attestation2" %>
<!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">
<title></title>
</head>
<body style="z-index: 1; left: 21px; top: 0px; position: absolute; height: 313px;
width: 983px">
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="Entitlementdlist" runat="server" AutoPostBack="true" Visible="true"
ToolTip="All the Requests in this dropdown are Entitlement Requests only">
</asp:DropDownList>
<%--asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>--%>
<asp:ListView ID="listview1" runat="server" ItemPlaceholderID="itemplaceholder" >
<ItemTemplate>
<table style="border:1px solid black;">
<tr>
<td>Report Name</td>
<td><asp:TextBox ID="ReportNameLbl" runat="server" Text='<%#Eval("REPORT_DESCRIPTION.rptdesctext") %>' Width="500"></asp:TextBox> </td>
<td>
<asp:CheckBoxList ID="CheckBoxList1" runat="server" RepeatDirection="Horizontal">
<asp:ListItem Text="Yes" Value="Yes"></asp:ListItem>
<asp:ListItem Text="No" Value="No"></asp:ListItem>
</asp:CheckBoxList>
</td>
</tr>
<tr>
<td>Content Description</td>
<td>
<asp:Label ID="ContentDescLbl" Text='<%#Eval("REPORT_REQUEST.StopLossMax") %>' runat="server" ></asp:Label>
</td>
<td>
<asp:CheckBoxList ID="CheckBoxList2" runat="server" RepeatDirection="Horizontal">
<asp:ListItem Text="Yes" Value="Yes"></asp:ListItem>
<asp:ListItem Text="No" Value="No"></asp:ListItem>
</asp:CheckBoxList>
</td>
</tr>
<tr>
<td>
Frequency
</td>
<td>
<asp:Label ID="frequencyLbl" Text='<%#Eval("REPORT_REQUEST.reportfrequency") %>' runat="server" ></asp:Label>
</td>
<td>
<asp:CheckBoxList ID="CheckBoxList3" runat="server" RepeatDirection="Horizontal">
<asp:ListItem Text="Yes" Value="Yes"></asp:ListItem>
<asp:ListItem Text="No" Value="No"></asp:ListItem>
</asp:CheckBoxList>
</td>
</tr>
<tr>
<td>
Recepients
</td>
<td colspan="2">
<td>
<asp:ListView ID = "lstview2" runat = "server" >
</asp:ListView>
</td>
</td>
</tr>
</table>
</asp:Table>--%>
</ItemTemplate>
</asp:ListView>
</div>
</form>
</body>
</html>
Inside your ListView you've to add a LayoutTemplate containing the PlaceHolder:
<asp:ListView ID="listview1" runat="server" ItemPlaceholderID="itemplaceholder" >
<LayoutTemplate>
<asp:PlaceHolder ID="itemplaceholder" runat="server" />
</LayoutTemplate>
<ItemTemplate>
...
</ItemTemplate>
</asp:ListView>
When the user pushes the Button, I'd like to display a modal dialog box to capture a couple of values from text boxes and submit these values to the server.
When the modal box is shown, I'd like the cursor to be placed in the txtFirst textbox.
How do I do this? I've had trouble with registerscript commands before, so if one is needed, I hope the syntax, if you provide it, is correct.
Thanks
<%# Page Language="VB" AutoEventWireup="false" CodeFile="MyModalSimple.aspx.vb" Inherits="MyModalSimple" %>
<%# Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<!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">
<title></title>
<script type="text/javascript">
function onOk() {
form1.submit();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Button ID="Button1" runat="server" Text="Button" />
<cc1:modalpopupextender id="Button1_ModalPopupExtender" runat="server" targetcontrolid="Button1"
popupcontrolid="pnlModal" okcontrolid="btnOK" cancelcontrolid="btnCancel" DropShadow="true" OnOkScript="onOk();">
</cc1:modalpopupextender>
<asp:Panel ID="pnlModal" runat="server" Style="display: None1"
BackColor="#CCCCCC">
<br />
<table>
<tr>
<td>
<asp:Label ID="lblFirst" runat="server" Text="First"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtFirst" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblLast" runat="server" Text="Last"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtLast" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
</td>
<td align="right">
<asp:Button ID="btnOK" runat="server" Text="OK" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" />
</td>
</tr>
</table>
<br />
<br />
</asp:Panel>
</div>
</form>
</body>
</html>
Also, how could I change the above code so that the modal dialog was displayed as a result of a selection of a dropdownlist item? If I set the targetcontrolid="DropDownList1", the dialog box is display when it drops rather than when a selection is made
An example can be found here. In essence you are using javascript.
I know this was already answered, but here's an easier code:
C#:
ScriptManager.RegisterStartupScript(this, this.GetType(), "FocusScript", "setTimeout(function(){$get('" + btnOk.ClientID + "').focus();}, 100);", true);
VB:
ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "FocusScript", "setTimeout(function(){$get('" + btnOk.ClientID + "').focus();}, 100);", True)
Remove Style="display: None1" from control panel