I have a master page named MainMasterPage.master i have a contentplaceholder1 and contentplaceholder2. Further, i am creating a nested master page which is using the contentplaceholder1, in this i am placing the labels. But these labels are not showing up.Where am i going wrong ?
In Nested master page
<asp:Content ID="Content1" ContentPlaceHolderID="cntplace1" Runat="Server">
<table width="100%">
<tr> <asp:Label runat="server" ID="lblImmu" Text="Immunization Details"></asp:Label></tr>
<tr><asp:Label runat="server" ID="lblDel"></asp:Label></tr>
<tr><asp:Label runat="server" ID="lblMal"></asp:Label></tr>
</table>
</asp:Content>
Related
how do I use a within an UserControl?
I always get the error, that the CheckBox should be placed within a FormTag (with runat=server), which is still existing on the MasterPage and it is not allowed to have two of them ...
Code of UserControl:
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="ctrlOrderEmailsDialog.ascx.cs" Inherits="WebClient.Controls.ctrlOrderEmailsDialog" %>
<%# Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<div id="OrderEmailDialog" runat="server">
<table id="OrderEmailDialogTable">
<tbody>
<tr>
<th>Nr.</th>
<td>
<asp:Label ID="labelId" runat="server"></asp:Label></td>
</tr>
<tr>
<th>ReturnReceipt:</th>
<td>
<%--<telerik:RadButton ID="checkboxReturnReceipt" runat="server" ToggleType="CustomToggle" ButtonType="ToggleButton" AutoPostBack="false">
<ToggleStates>
<telerik:RadButtonToggleState Text="UnChecked" PrimaryIconCssClass="rbToggleCheckbox"></telerik:RadButtonToggleState>
<telerik:RadButtonToggleState Text="Filled" PrimaryIconCssClass="rbToggleCheckboxFilled"
Selected="true"></telerik:RadButtonToggleState>
<telerik:RadButtonToggleState Text="Checked" PrimaryIconCssClass="rbToggleCheckboxChecked"></telerik:RadButtonToggleState>
</ToggleStates>
</telerik:RadButton>--%>
<asp:CheckBox ID="checkboxReturnReceipt" runat="server" />
</td>
</tr>
<tr>
<th>Mailtext:</th>
<td>
<asp:Label ID="OrderEmailText" runat="server">
</asp:Label>
</td>
</tr>
</tbody>
</table>
</div>
Form Tag (already existing within the SiteMaster page):
<form id="MainForm" runat="server">
System.Web.HttpException:
"The control ctrlOrderEmailsDialog_checkboxReturnReceipt type CheckBox must be positioned in a form tag with runat = server." which is existing ...
Can you guys give me a small hint?
Thank you.
//SiL
I have the following code. It works as is, but... I am not always going to have an even number of items in the RSS feed So, at the end of the table, I might have only one table cell on the last row. So, is there a way to count the number of ItemTemplates and AlternatingItemTemplate, so if it is an odd number I would be able to add another cell <td> </td></tr> and close the table row?
<asp:XmlDataSource ID="SomeFeed" DataFile="TestSomeRSS.xml" XPath="rss/channel/item" runat="server"></asp:XmlDataSource>
<asp:ListView ID="SomeFeedScroller" DataSourceID="SomeFeed" ItemPlaceholderID="SomePlcID" runat="server">
<LayoutTemplate>
<table id="ListingsTable" cellpadding="0" cellspacing="0" align="center">
<asp:PlaceHolder ID="SomePlcID" runat="server"></asp:PlaceHolder>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr style="vertical-align:top;">
<td class="bnotes" style="width:325px;padding:5px;">
<%# XPath("title")%><br />
<%# XPath("description")%><br />
</td>
</ItemTemplate>
<AlternatingItemTemplate>
<td class="bnotes" style="width:325px;padding:5px;">
<%# XPath("title")%><br />
<%# XPath("description")%><br />
</td>
</tr>
</AlternatingItemTemplate>
</asp:ListView>
Thanks in advance for your help.
I'm not sure what you're asking, but why not just put a complete row in the ItemTemplate and AlternatingItemTemplate, like this:
<ItemTemplate>
<tr style="vertical-align:top;">
<td class="bnotes" style="width:325px;padding:5px;">
<%# XPath("title")%><br />
<%# XPath("description")%><br />
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr style="vertical-align:top;">
<td class="bnotes" style="width:325px;padding:5px;">
<%# XPath("title")%><br />
<%# XPath("description")%><br />
</td>
</tr>
</AlternatingItemTemplate>
That way you don't have to figure it out yourself - just let the control render itself.
EDITED TO ADD
Looking at your posted code again, it looks like you might have been attempting one row of alternating cell styles. I think you misunderstood the intent of the ItemTemplate and AlternatingItemTemplates; they usually deal with the fields (columns) of a given record.
In this case, you'd have the first RSS feed item in an ItemTemplate, then the second RSS feed item in an AlternateItemTemplate (i.e., another row), then the third RSS feed item in an ItemTemplate and so on.
I hope this helps - if I've misunderstood what you're trying to do let me know.
2nd Edit
Based on the example layout posted in the comments, I think the DataList Class would be a better option, as you can easily specify multiple columns (using the RepeatColumns property). Something like this:
<asp:XmlDataSource ID="SomeFeed" DataFile="TestSomeRSS.xml" XPath="rss/channel/item" runat="server">
</asp:XmlDataSource>
<asp:DataList ID="SomeFeedScroller" DataSourceID="SomeFeed"
RepeatColumns="2" RepeatDirection="Horizontal"
RepeatLayout="Table" runat="server">
<ItemStyle CssClass="bnotes" Vertical-Align="top" Width="325px" />
<AlternatingItemStyle CssClass="bnotes" vertical-Align="top" Width="325px" />
<ItemTemplate>
<%# XPath("title")%><br />
<%# XPath("description")%>
</ItemTemplate>
<AlternatingItemTemplate>
<%# XPath("title")%><br />
<%# XPath("description")%>
</AlternatingItemTemplate>
</asp:DataList>
The above is not tested, but the general idea was to keep the formatting as close to what was in the ListView as possible.
Another possible approach might be something similar to this thread on having multiple columns in a Repeater control: Multiple columns in a repeater.
The DataList control supports editing, selecting, updating, etc like ListView. The Repeater control does not.
I want to have 4 links in the sidebar of master page which every other form (content page) in my web application inherits.
<table>
<tr>
<td width= "150px">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
<asp:Menu runat="server" ID="MainMenu1" CssClass="MasterContent" StaticSubMenuIndent="30px">
<Items>
<asp:MenuItem Text="My Software" NavigateUrl="~/MySoftware.aspx"></asp:MenuItem>
<asp:MenuItem Text="Check Out" NavigateUrl="~/CheckOut.aspx"></asp:MenuItem>
<asp:MenuItem Text="View Shopping Cart" NavigateUrl="~/ShoppingCart.aspx"></asp:MenuItem>
<asp:MenuItem Text="Continue Shopping" NavigateUrl="~/Start.aspx"></asp:MenuItem>
</Items>
</asp:Menu>
</asp:ContentPlaceHolder>
</td>
<td width="900px">
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
</table>
This is the content in the master page as you can see there are 4 menu items i tried to form as sidebar and i tried to inherit in home.aspx(one of the content pages) as follows:
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="Start.aspx.cs" Inherits="WebStore._Start"
MasterPageFile="~/Webstore.Master" %>
<asp:Content ID="StartSideBar" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
But unfortunately the sidebar is not at all getting displayed. I know i'm doing fundamentally wrong some where. My intention is to have web pages to have sidebar like this. It is a screenshot of my intended page.
Can some one guide me through this.
Thanks in anticipation
The way you have it set up, your home.aspx file is clobbering your menu links because it is defining the content of ContentPlaceholder1 to be empty (or something else at any rate), which is overriding the menu links you put in your MasterPage inside the same content holder. The way MasterPages and content pages work is that the MasterPage defines a location (a ContentPlaceholder) for the content page (e.g., home.aspx) to load content into. But you have put actual content you want to keep inside a ContentPlaceholder on your MasterPage--which means that any content page (again, like home.aspx) that defines content for ContentPlaceholder1 (like you do with StartSideBar) is going to override anything defined inside ContentPlaceholder1 on the MasterPage--in this case, your menu links.
If you want your menu links to remain constant on every content page, then you should move them out of ContentPlaceholder1 on the MasterPage and make them just markup on the MasterPage (in fact, you should probably remove ContentPlaceholder1 altogether). The easy way to do this is to comment out the ContentPlaceholder tag itself like this:
<table>
<tr>
<td width="150px">
<%--<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">--%>
<asp:Menu runat="server" ID="MainMenu1" CssClass="MasterContent" StaticSubMenuIndent="30px">
<Items>
<asp:MenuItem Text="My Software" NavigateUrl="~/MySoftware.aspx"></asp:MenuItem>
<asp:MenuItem Text="Check Out" NavigateUrl="~/CheckOut.aspx"></asp:MenuItem>
<asp:MenuItem Text="View Shopping Cart" NavigateUrl="~/ShoppingCart.aspx"></asp:MenuItem>
<asp:MenuItem Text="Continue Shopping" NavigateUrl="~/Start.aspx"></asp:MenuItem>
</Items>
</asp:Menu>
<%-- </asp:ContentPlaceHolder>--%>
</td>
<td width="900px">
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
</table>
You will also have to remove the ContentPlaceholder reference from your content page as well, or you will get a compliation error (because you removed it from the Master, it can't exist in the content page--but that's okay, the MasterPage now has the links you want):
<%# Page Title="" Language="C#" MasterPageFile="~/Webstore.master"
AutoEventWireup="true" CodeFile="Start.aspx.cs" Inherits="Start" %>
<%--<asp:Content ID="SideBarStart" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content>--%>
How to access controls in master page using javascript? The master page consists of a search textbox, on key down event of the control I call a javascript function writtern inline of the master page. I get the value of entered in textbox in that javascript function. I have tried giving document.getElementById("<%=txtSearch.ClientID %>").value as well as document.getElementById("txtSearch").value. Both display error. I have to access the textbox control from within the master page itself!
I think some important bits of markup are missing from what you showed in the comment. I tried it, and the following code works. Check it out, maybe you'll see where your problem is; otherwise, please explain where your markup is different.
<%# Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="WebApplicationDummy.SiteMaster" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
<title></title>
<script type="text/javascript">
function txtSearch_KeyDown() {
alert(document.getElementById('<%=txtSearch.ClientID %>').value);
}
</script>
</head>
<body>
<form runat="server">
<table width="226" border="0" cellpadding="2" cellspacing="2">
<tr>
<td width="150" align="right">
<asp:TextBox ID="txtSearch" CssClass="para1Black" Width="180px" ValidationGroup="GlobalSearch"
runat="server" MaxLength="100" onkeydown="txtSearch_KeyDown()"></asp:TextBox>
</td>
<td width="62">
<asp:ImageButton ID="imgbtnSearch" ToolTip="Click to search." ImageUrl="images/search2.jpeg"
CausesValidation="true" Width="22px" Height="22px" runat="server" ValidationGroup="GlobalSearch" />
</td>
</tr>
</table>
<asp:ContentPlaceHolder ID="MainContent" runat="server" />
</form>
</body>
</html>
My tab control items contain three different pages.Clicking on tabitem ,they are visible,but when want to perform javascript event on page item then problem arise.javascript well works for only first tab control item,rest of them are not work.Show me the bellow error.
Microsoft JScript runtime error: 'this.GetStateInput().value' is null or not an objec
tabcontrol
**tab item1 contain page1
tab item2 contain page2
tab item3 contain page3**
i write javascript on page1 control,it's work well but rest of pages javascript show the above error message. i work on devexpress control
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="UCCharge.ascx.cs" Inherits="WebCore.UserControls.ChargeSettings.UCCharge" %>
<%# Register assembly="DevExpress.Web.v9.1, Version=9.1.2.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073" namespace="DevExpress.Web.ASPxTabControl" tagprefix="dxtc" %>
<%# Register assembly="DevExpress.Web.v9.1, Version=9.1.2.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073" namespace="DevExpress.Web.ASPxClasses" tagprefix="dxw" %>
<%# Register src="UCConfig_Charge_Company_Wise.ascx" tagname="UCConfig_Charge_Company_Wise" tagprefix="uc1" %>
<%# Register src="UCConfig_Charge_Depository_Company_Wise.ascx" tagname="UCConfig_Charge_Depository_Company_Wise" tagprefix="uc2" %>
<%# Register src="UCconfig_charge_operation_mode.ascx" tagname="UCconfig_charge_operation_mode" tagprefix="uc3" %>
<%# Register src="../InvestorAccount/UCconfig_Investor_Account_Wise_Charge.ascx" tagname="UCConfig_Investor_Account_Wise_Charge" tagprefix="uc4" %>
<table>
<tr>
<td>
<dxtc:ASPxPageControl Width="500px" ID="ASPxPageControl1" runat="server" ActiveTabIndex="0"
EnableCallbackCompression="True" EnableHierarchyRecreation="True"
AutoPostBack="True">
<TabPages>
<dxtc:TabPage Text="Charge Company">
<ContentCollection>
<dxw:ContentControl ID="ContentControl1" runat="server">
<uc1:UCConfig_Charge_Company_Wise ID="UCConfig_Charge_Company_Wise" runat="server" />
</dxw:ContentControl>
</ContentCollection>
</dxtc:TabPage>
<dxtc:TabPage Text="Charge Depository Company">
<ContentCollection>
<dxw:ContentControl ID="ContentControl3" runat="server">
<uc2:UCConfig_Charge_Depository_Company_Wise ID="UCConfig_Charge_Depository_Company_Wise"
runat="server" />
</dxw:ContentControl>
</ContentCollection>
</dxtc:TabPage>
<dxtc:TabPage Text="Investor Charge ">
<ContentCollection>
<dxw:ContentControl ID="ContentControl5" runat="server">
<uc4:UCConfig_Investor_Account_Wise_Charge ID="UCConfig_Investor_Account_Wise_Charge"
runat="server" />
</dxw:ContentControl>
</ContentCollection>
</dxtc:TabPage>
<dxtc:TabPage Text="Charge Operation Mode ">
<ContentCollection>
<dxw:ContentControl ID="ContentControl4" runat="server">
<uc3:UCconfig_charge_operation_mode ID="UCconfig_charge_operation_mode"
runat="server" />
</dxw:ContentControl>
</ContentCollection>
</dxtc:TabPage>
</TabPages>
</dxtc:ASPxPageControl>
</td>
</tr>
</table>
I read on a Support issue of a user getting this error, in his case it was because he was using value (myTextBox.value) when getting the value of a DX Control instead of the GetValue() (myTextBox.GetValue()) client method DX provides. Could this be the same thing happening in your code as well?