C# - Adding A .ASCX Item To The Sitemap?
Aug 23, 2010
Is there a way to add .ascx files to a sitemap such that it will load/unload the controls based on the last ones visited? The problem is i have a page that contains a few controls that get placed under one another, and i'd like to just be able to jump between them with the sitemap instead of creating a new page for them... this is what i'm trying to put into the sitemap without luck (see Product List, Product Detail):
<siteMapNode url="Default.aspx" title="Home" description="Home Page of Genuity">
<siteMapNode url="UserFunctions/ChangePassword.aspx" title="Change Password" description="Change Password" />
<siteMapNode url="Setup/EditUsers.aspx" title="Edit Users" description="Edit Users" />
<siteMapNode url="Setup/EditTraits.aspx" title="Edit Traits" description="Edit Traits" />
<siteMapNode url="DataEntry/EditSeedPartners.aspx" title="Seed Partners" description="Seed Partners">
<siteMapNode url="WebControls/Product List.ascx" title="Product List" description="Product List" >
<siteMapNode url="WebControls/ProductDetail.ascx" title="Product Detail" description="Product Detail" />
</siteMapNode>
</siteMapNode>
</siteMapNode>
View 1 Replies
Similar Messages:
Oct 6, 2010
I have a repeater control:
<asp:Repeater ID="rep" DataSourceID="XMLDSCompare" runat="server">
<ItemTemplate>
<h4><%# XPath("title")%></h4>
</ItemTemplate>
</asp:Repeater>
Now if its the first item in the total resultset, I want to add <div> to ItemTemplate control, if its the 2nd item, I want to add </div>
So output would be (not including table tags generated by repeater control):
<div>
title 1
title 2
</div>
<div>
title 3
title 4
</div>
<div>
title 5
title 6
</div>
How would I do this in the ItemDataBound event of repeater control?
View 6 Replies
Mar 25, 2011
I have a menu control which is based on a sitemap as below.
However whilst the security aspect is working i.e. users cannot access a page without being in the correct role the menu does not seem to hide any of the menu items.
I really want users only to see the help menu item before they log in, then after this point they should see all items unless they are External in which case the Uploads and Admin Items should be hidden.
Is this not possible or have I set up my sitemap wrong?
If I remove roles="*" from the first node no menu items are visible at all even after login?
[Code]....
View 9 Replies
May 16, 2010
I'm getting this error:
Compiler Error Message: CS0118: 'Configuration' is a 'namespace' but is used like a 'type'
Configuration myWebConfig = WebConfigurationManager.OpenWebConfiguration("~/");
This code has been in place for 5+ months without this issues, only today after adding this sitemap code do I have this issue.
<siteMap defaultProvider="ExtendedSiteMapProvider" enabled="true">
<providers>
<clear/>
<add name="ExtendedSiteMapProvider" type="Configuration.ExtendedSiteMapProvider" siteMapFile="Web.sitemap" securityTrimmingEnabled="true"/>
</providers>
</siteMap>
I tried adding "System.Web." before the "Configuration ", but that did not work either:
System.Web.Configuration myWebConfig = WebConfigurationManager.OpenWebConfiguration("~/");
Error 1 'System.Web.Configuration' is a 'namespace' but is used like a 'type'
View 2 Replies
Aug 26, 2010
I added web.sitemap file in my project.on Debug it shows an exception like this"The file
web.sitemap required by XmlSiteMapProvider does not exist."
how to solve the above error and any changes made in web.config file after adding web.sitemap file?
View 3 Replies
Aug 5, 2010
I have a dropdown list on my homepage which users select a category. After selecting the category, user will fill a form which has related controls to that category in it.
As I have many categories, I just want to have single ascx page and adding controls to it dynamically according to the user choice.
For example: One chose Telephone category, he will face a form having drop down lists asking, what brand? what color? And one chose, book category, he will face drop down lists asking which type? howmany pages?
So 1 ascx must do my work at runtime done as I have alot of categories.
I am going to take these criterias from a database table which has CategoryID and Criteria colomns.
And if I can do that, will it be possible to add field validators to these dynamically created controls.
View 1 Replies
Feb 8, 2011
I've added a subarea to my sitemap in CRM 4.0, and for absolute URLs it works as expected. However, for relative URLs it does not. The page in question is internal and is accessed through:
http://localhost/ISV/<orgName>/Account.aspx/ExternalDocumentList
However, I would prefer writing this in sitemap:
/ISV/<orgName>/Account.aspx/ExternalDocumentList
When this is expanded, CRM/IIS rewrites it to:
http://localhost/<orgName>/ISV/<orgName>/Account.aspx/ExternalDocumentList
For reference, here is the sitemap addition (which doesn't work):
<SubArea Id="custom_documentHistory" Url="/ISV/<orgName>/Account.aspx/ExternalDocumentList">
<Titles>
<Title LCID="1033" Title="Document History"/>
</Titles>
</SubArea>
How can I link to this page relatively?
View 1 Replies
Feb 15, 2010
I'm not sure that what I need to do is possible.I'm using the SQL SiteMap Provider as the source for my main navigation menu. When a user hits my site, they are asked to enter their location (town name). This preference setting is being stored using the Profile Provider. The page then reloads to showwww.mysite.com/liverpool in the address bar, for example. The information shown on this page is relevant to where they are. I'm using URL rewriting to map this to a page that is passed a parameter (eg. viewZone.aspx?ZoneID=234). I now need to insert the town name into some of the URLs generated from the sitemap. For example:www.mysite.com/cars-for-salewould becomewww.mysite.com/liverpool/cars-for-saleSome URLs would need to remain unchanged such as www.mysite.com/shop.Do you know if this is possible? If needed I could put a placeholder inside the URL in the database - **townName**/cars-for-sale and then run some kind of replacement procedure at run-time, but I don't know where in the execution process I could do that.
View 5 Replies
May 11, 2010
We are getting this error message when we try to click the link in the menu to go to Report Server:
Source Error:
Line 31: <siteMapNode title="Reports" description="Reports">
Line 32:
Line 33: <siteMapNode url="https://ffxsqldgc01.ffx.co.fairfax.va.us/Reports/Pages/Folder.aspx?ItemPath=%2fDPZ&ViewMode=List" title="View Reports"
description="Click here to view the reports" />
Line 34: </siteMapNode>
Line 35:
I tried to add after the &, as it was suggested on one of the forum but it did not work. Any other ideas.
View 5 Replies
Aug 2, 2010
I've been having some production runtime errors that I don't fully understand. This has happened to us on a couple different ASP.NET 4.0 Web Sites (shudders - yes, I know - we're porting it to MVC but that's taking some time).
First of all, we have never been able to reproduce this issue in development/QA environments. Secondly, upon deployment, the issue seems to be non-existent. Sometimes the issue manifests within a day or two of deployment and other times the deployment will be live for a month without it manifesting at all. However, once it manifests, then ANY page viewed under the web site causes the error. Lastly, this problem seemed to only come up once we migrated to .NET 4.0. We started at 2.0, a year ago upped to 3.5, and recently upped to 4.0 with this solution and most child projects.
The error:
Could not find the sitemap node with URL '~/Default.aspx'.
A simplified version of our sitemap (with some names changed and uninteresting nodes removed) is as follows:
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
<siteMapNode roles="*" title="EG">
<siteMapNode url="~/../SM/Default.aspx" title="Welcome" description="" roles="*" />
<siteMapNode url="~/../SD/Default.aspx" title="SD" description="" roles="*" />
<siteMapNode url="~/../SMD/Default.aspx" title="SMD" description="" roles="*" />
[code]...
I have confirmed in all of the SiteMaps that there is a node with url="~/Default.aspx" with roles="*" (which includes public/anonymous access), so I am very confused as to why this problem occurs.
SiteMap does not have a node for Default.aspx. All of them do. SiteMap's Default.aspx node is not accessible for security reasons to the current user/role. They're all accessible to anonymous users and this problem even exists for super admin users. Passed-in URL contains querystrings (Default.aspx?abcd). I don't know if this is a problem (I sure would hope not) but once the problem manifests itself, I can handwrite the URL with no querystrings and the problem still exists.
SiteMap changes. It doesn't Service's permissions to the sitemap file. The sitemap works perfectly fine after a deployment, so unless permissions are changed in a way that IISRESET fixes, then this is not an issue. The worker process becomes globally corrupt. I don't think so. We have ~12 web sites all in the same app pool and the problem always stays confined within a single web site. Also, we have yet to have this happen to more than a single web site at a time although it has manifested itself in 4 different ones so far.
View 1 Replies
Aug 10, 2010
I have to build a few ascx partial views in my MVC applications to encapsulate re-usable functionalities as well as archive SOR and SOC. However, I encountered challenge how to encapsulate the business logic that drives MVC ascx views.In webforms, the code behind of an ASCX control can handle a button click event and browser still shows the same page with only one postback. How can I archive the same thing in MVC? When ~/Address/Edit/2 includes an ascx partial view with a button on it that calls another MVC action - let's say ~/ShareController/CommonAction - what is the best way for the CmmonAction to return to the very same view that includes the ascx file?Perhaps I am missing a common pattern in MVC web development?
View 5 Replies
Jan 25, 2011
I've got a custom menu navigation built from a web.sitemap file, the first line of this would be something like:
SiteMapNodeCollection topLevelNodes = SiteMap.RootNode.ChildNodes;
However, now I want to be able to create multiple web.sitemap files, and then programmatically determine which web.sitemap file to use, but I can't seem to find out how to do this. I'm assuming I could either create one custom SiteMapProvider that can perform the logic to determine which web.sitemap file to load, or I have multiple providers, each one with the SiteMapFile property set to a specific *.sitemap file, and then switch providers programmatically before I access SiteMap.RootNode.
View 2 Replies
Apr 14, 2010
I am having difficulties how to construct my question, but if I have to put it simply the situation is that I have categories of products. I have an aspx with a repeater on the left that lists the categories. And I want the products to be listed on the right. Category number is variable so I made an ascx with a DataList in it. When I try to do foreach category, ascx = new ascx(); then the DataList within this ascx control is null.
ps: what I want to do is to preload all the products (thre is not much) and hide the divs and fadein fadeout them using jQuery when a category div is clicked.
rightnow it is using jQuery.load(); and I don't like how the images load, cuz they download from top to bottom. Progressive gifs alsdo not an option. site demo is here [URL]
View 1 Replies
Apr 9, 2010
I have a checkboxlist which is being dynamically populated. Code is below.
chklbCourses.DataSource = dt; // datatable returning
CourseName,CourseID and price
chklbCourses.DataTextField = "CourseName";
chklbCourses.DataValueField = "CourseID";
chklbCourses.DataBind();
Now I want to add another item to checkboxlist which is price of each item that is coming from database. How can I attach third value "Price" to each item of checkboxlist. Do I need to add attribute or what to each item ?
View 9 Replies
Jan 19, 2010
I've added a div overlay to my repeater control using absolute positioning. Predicably, this simply renders all of the divs in the same place. Is there any way that I can put this overlay over each row of my repeater?
<table style="border-style:None;width:350px;border-collapse:collapse;">
<tr>
<td>
<b>ID</b>
</td>
<td>
<b>User Name</b>
</td>
<td>
<b>Role</b>
</td>
<td>
<b>Last Logged On</b>
</td>
</tr>
<asp:Repeater ID="rptUsers" runat="server"
onitemdatabound="rptUsers_ItemDataBound">
<ItemTemplate>
<div style="position:absolute; top:57px; width:350px; height:16px;" />
<tr>
<td>
<asp:Label id="lblUserID" runat="server" Text='<% # Eval("ID") %>'></asp:Label>
</td>
<td>
<asp:Label id="lblUserName" runat="server" Text='<% # Eval("UserName") %>' ></asp:Label>
</td>
<td>
<asp:Label ID="lblUserRole" runat="server" Text='<% # Eval("UserRole") %>' ></asp:Label>
</td>
<td>
<asp:Label ID="lblUserLastLoggedOn" runat="server" Text='<% # ((DateTime)Eval("LastLogin") != DateTime.MinValue) ? Eval("LastLogin") : "Never" %>' ></asp:Label>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
View 1 Replies
Jun 2, 2010
I'm adding an attribute to my DataGridItem like this:
e.Item.Cells[i].Attributes.Add()
How could add an attribute to it's child?
Would it be something like e.Items.Cells[i].Child.Attributes.Add()
View 3 Replies
Dec 2, 2010
I have written the piece of code below to get a productID from a gridView when the user clicks on the select link.
Convert.ToInt32(GridView1.SelectedDataKey.Values["productID"])))
However, if a user clicks on this more than one click the newer value replaces the previous. Is there a way to keep adding to the cart list when the user clicks on a new item?
Edit:
Here's my code for the Shopping Page:
[Code]....
I dont know if the location of creating the list is important? Wasn't sure if it was placed in the click event if it would keep creating a new instance?
Then for the Basket Page I have:
[Code]....
View 3 Replies
Mar 28, 2011
The following code has only thrown a NullReferenceException a handful of times over the last several months, but I'm not exactly sure why. The code isn't mine, but it looks pretty straight forward to me.
[Code]....
The only thing I can think of is that pageType is null when it's being used as a dictionary key, but apparently that is not possible.
The code that calls it is simple:
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
_mypage = GetPage();
}
I also thought that the error might be with the _section.Pages, but section is never null and never sets anything. If .Pages[page] returns null, the MyPage constructor simply returns. So what am I missing?
View 5 Replies
Feb 16, 2011
I'm working on an ASP.NET webforms app that will serve as a simple intake form to create work items in TFS 2010.The app works correctly when I run it locally in debug mode--the submission completes and the work item is created.
When I publish the form to our dev server, it yellow screens and throws the following error:
[SecurityException: TF50309: The
following account does not have
sufficient permissions to complete the
operation: DOMAINNAMESERVERNAME$. The
following permissions are needed to
perform this operation: View
collection-level information.]
In my code, I'm attempting to access TFS using a service account, and from what I can tell the service account is being used correctly when I run in debug mode.Here's what my C# looks like:
string tfsServerUrl = "http://servername:8080/tfs";
string tfsProject = "Web Team Projects"; [code]....
If I set a breakpoint at the tfs.Authenticate() line, the server object shows the service account name as the current user and IsAuthenticated = true.
The line in the exception that mentions SERVERNAME$ is what's stumping me. It's seems like IIS is deciding to try to access TFS with the app pool identity instead of the credentials that I'm explicitly supplying.Our dev server is a Server 2008 box running IIS 7.
View 1 Replies
Nov 22, 2010
I have a databound dropdown list (ASP.net). I want the page to load with a certain item as the selected item.
I am not adding a blank first row (thats not what i need)I find that I can get this to work with "AppendDataBoundItems" to true, but the side-effect is that I have all the items listed twice.
View 1 Replies
Jul 21, 2010
I'm trying to add a DataList to a panel and add a chart to the DataList.
[Code]...
View 1 Replies
Jan 2, 2010
After I execute a data reader and put the readed string from the database in my dropdownlistbox, I cannot add another item in it.Here's my code:
con.Open()
Dim com As New OleDbCommand("Select Status from Table where Id = 'somevalue' ", con)
Dim dr As OleDbDataReader
[code]...
View 5 Replies
Feb 24, 2010
I inherited an application written for VB.Net and am converting it over to ASP.Net, with VB as the back end. I have a data pull that adds values to a new instance of a class, then adds the item to a listbox. It worked great in the VB.Net version, but I get the following error in the Visual Studio Text Editor when I try to use the code:
Overload resolution failed because no accessible 'Add' can be called with these arguments:
'Public Sub Add(Item As System.Web.UI.WebControls.ListItem)':Value of type 'MyItem' cannot be converted to System.Web.UI.WebControls.ListItem'.
'Public Sub Add(Item as String)':Value of type 'MyItem' cannot be converted to String.
I have played around with the code quite a bit and have been researching online, but I'm just drawing a blank here.
I put the class("MyItem") in the "App_Code" folder in a file called "MyItem.vb". The class code is as follows:
[Code]....
The code I have for the sub that is supposed to add the items to the listbox is as follows:
[Code]....
View 6 Replies
Jul 7, 2010
I have a list item collection. How to add this list item collection to a datatable.
The list item collection has the following fields:
Student Name, Maths Mark
John 20
Mac 30
John 35
I want to create a html table from the data table, which is grouped on the Student Name field.
View 2 Replies
Nov 2, 2010
I have a gridview in which one of the columns is a DropDownList.
In another column I have a TextBox and a button next to it.
I want to use the OnClick event of the button to add the text in the The TextBox as a new list item in the DropDownList of that row.
I've this code wit no success:
protected void btnAdd_Click(object sender, EventArgs e)
View 1 Replies