I have a asp.net webformpage without a MasterPageFile property at the top but I have asp:content tags in there. I assume this page has a masterpage what is the masterpage in this case?
Check web.config maybe there is a global master page define in the <page> element there.
Also, check the code-behind. Maybe it's declared in code.
Related
Hi I'm using in my application with ASP.NET WebForms and VB.NET (code behind) the ajaxcontroltoolkit so, i need use enable a page method but if I add
< asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True" EnablePageMethods="True" > < /asp:ScriptManager >
to the code this mark error:
You can only add one instance of ScriptManager to the page.
My question is in ajaxcontroltoolkit exist a function equal to EnablePageMethods of ScriptManager?
It may likely that you would have definitely added a ScriptManager somewhere else in your .aspx Page or MasterPage or UserControl.
If you have declared a ScriptManager on your Master page, then in your content pages you would use a ScriptManagerProxy. This will act as a proxy to the real ScriptManager on your master page.
Here is the MSDN link that describes about ScriptManagerProxy
Only one instance of the ScriptManager control can be added to the page. The page can include the control directly, or indirectly inside a nested component such as a user control, content page for a master page, or nested master page. If a page already contains a ScriptManager control, but a nested or parent component needs additional features of the ScriptManager control, the component can include a ScriptManagerProxy control. For example, the ScriptManagerProxy control enables you to add scripts and services that are specific to nested components.
Ensure that you have only one asp:Scriptmanager on the
masterpage.
If you don't need a asp:Scriptmanager in materpage then remove it and declare it in content pages whichever needs it.
If you have a ScriptManager in masterpage then make sure you also have only one
asp:ScriptManagerProxy on every content page that might require a script manager.
I have compiled ASP.NET dynamic page with editable aspx pages.
I would like to some links to be generated upon changing some static variable
What i did is edit:
web.config as follows:
<appSettings>
<add key="currentEnvironment" value="dev-"/>
</appSettings>
and then
edited aspx page as follows
Home
But there is nothing appened when i try and run the .aspx page. Please help
You can't put a server tag inside another tag's markup like that, but you can just use the value directly. If you remove it and change the # to a =, it will work.
Home
Although if you can access the code behind, that would be a much cleaner way to do it, as in:
<asp:HyperLink ID="_index" runat="server">Home</asp:HyperLink>
and then set value from code behind
_index.NavigateUrl = String.Format("http://{0}www.mysite.com/web/index.html", ConfigurationSettings.AppSettings["currentEnvironment"]);
In my ASP.NET 3.5 project, most content pages have ScriptManager control but the Master Page does not have. I now want to use UpdatePanel in the master page but it is not permitting to put another ScriptManager.
I cannot change to ScriptManagerProxy in content pages as the change needs to be replicated to around fifty pages.
Is there any way to use UpdatePanel in Master Page by either sharing content page's ScriptManager or something else?
three ways I can think.
First way is to use place the ScriptManager inside the ContentPlaceHolder, on the other pages that also have ScriptManager this will be overwrite, in the one that you want to exist, just not use this ContentPlaceHolder, if this is possible.
<asp:ContentPlaceHolder ID="PlaceHolderID" runat="server" >
<asp:ScriptManager ID="ScrMang" runat="server" >
</asp:ScriptManager>
</asp:ContentPlaceHolder>
Second way is to make a second master page, come from the first, and use this second master page with ScriptManager and all the rest, if this is possible.
And last, change all 50 pages, move the ScriptManager to master page, remove it from the rest. Some time we do that :)
Can anyone tell me if I can dynamically set the file name when registering a user control please, for example:
<%# Register src="[file name]" tagname="WebUserControl" tagprefix="uc1" %>
No, I don't believe you can. What you can do is register all of the possible controls that you might use on the page, either in the page directive or the web.config.
EDIT
What you can do, if this helps, is to add the controls dynamically in code-behind using the LoadControl method. This way, you can create instances of whatever user controls you want without worrying about registering them in the page directive or web.config. Thanks #Gabriel for pointing this out.
I have a page login.aspx in a folder which is linked to masterpage. In the page load event of masterpage I have added some styles. When I redirect to login.aspx, it is just not able to get the styles from the masterpage's pageload event. I analysed the problem found that because my login.aspx is not in root folder, but in a folder which is inside root folder.
How do I run masterpage's pageload event in login.aspx?
You can place all your style sheets in a folder structure as follows:
App_Themes/Style/mystylesheet.css
Then in your content ASPX pages, just add Theme="Style" to the page directives and ASP.NET will automatically resolve it for every page that you have :-)
I assume you're talking about CSS stylesheets, and not ASP.NET styles (themes).
In that case, you can using a tag like the following from your Master page:
<link runat="server" rel="Stylesheet" href="~/scripts/common.css"
type="text/css" />
Or you can insert the same tag programmatically from your Page_Load() handler. However, in that case, it's best if you add the HtmlLink control to the Head control. Alternatively, you can add an ID to the control and use Visible="True" to control whether it appears in the generated markup.
If the code works when you move the code to your templatized page (not the but the one that uses it) then it suggests that you are using a relative link for the stylesheet.
I'd recommend using a relative URL off the root (something in the form of "/stylesheet.css") so that when you have pages that use the template, but in a subdirectory, it can resolve the stylesheet correctly.
The problem is that the section of the markup is located in the Master Page, so the reference to the StyleSheet cannot be made
Dim link As New HtmlLink
link.Href = "LocationOfStyleSheet.css"
link.Attributes.Add(HtmlTextWriterAttribute.Rel.ToString(), "stylesheet")
Page.Header.Controls.Add(link)