Web Forms :: Modify Xml File In Memory To Dynamically Populate Querystring - SiteMap.CurrentNode Is NULL
Dec 24, 2010
I m using multiple sitemaps in my website. The providers are defined in web.config file as:
[Code]....
[Code]....
Now I m trying to modify one of my xml file in memory to dynamically populate querystring but when I use
Dim currentNode
As
SiteMapNode =
SiteMap.CurrentNode.Clone(True)
I get Null in my currentNode and I cant point to the node.
View 5 Replies
Similar Messages:
Feb 28, 2011
i am developing website in which i am using web.sitemap to create breadcrumbs now the problem is that when i use to debug the nodes the internal links come null
<siteMapNode url="~/Public/Home.aspx" title="Home" description="Home"><siteMapNode url="~/Public/news.aspx" title="News" description="News">
<siteMapNode url="~/Public/event_Calender.aspx" title="Event Calender" description="Event Calender" />
</siteMapNode></siteMapNode>
as u can see now here my event_calender come null when i use to debug it from code.
IS there anyone who know how i can fix it.
View 6 Replies
Mar 7, 2010
I've run into an issue where calling SiteMap.CurrentNode returns null when it really shouldn't be. I'm using SiteMap.CurrentNode to highlight certain buttons on the page and generate a sub navigation bar (through SiteMap.CurrentNode.ChildNodes).
Now this works until I attempt to get to my pages of which are generated by a dynamic provider. For some reason whenever I attempt this on my Projects page SiteMap.CurrentNode returns null. Overall this is a bad situation for my program because then I cant generate my sub-navigation bar.
I was hoping someone here might be able to figure out the fault in my Sitemap or provider so that I can do a basic tutorial to others who are attempting the same thing since I haven't seen a tutorial that implements a provider in the manner that I have.
Web.SiteMap:
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/Default.aspx" title="Home" description="Home page where updates and other information can be found">
<siteMapNode provider="ProjectProvider" />
<siteMapNode url="~/Contact/Default.aspx" title="Contacts" description="Contacts" />
</siteMapNode>.......
Provider:
Implements the following methods and all of them do not return Null (I checked via debug):
- RootNode
- GetRootNodeCore
- Initialize
- Clear
- BuildSiteMap
View 10 Replies
Apr 8, 2010
I have a SiteMap navigation using an asp:repeater control databound to a SiteMapDataSource. The repeater contains an asp:hyperlink for each node, and the CssClass is explicitly defined:
[Code]....
How would I cause the item that corresponds to the current node on the sitemap tree to have a different CssClass? I've had a few unsuccessful attempts (stab in the dark in all honesty) using the ItemDataBound event handler and inline code.
View 2 Replies
May 7, 2015
The following code works well as long as I pass a querystring value to the datalist.
Private Sub BindGrid()
Dim id As Integer = Integer.Parse(Context.Request.QueryString("id"))
Dim strConnString As String = ConfigurationManager.ConnectionStrings("Conn").ConnectionString
Using con As New SqlConnection(strConnString)
Using cmd As New SqlCommand()
cmd.CommandText = "select Id, Name from tblFiles where Id=@Id"
[Code] ......
However, the page errors with the message "Value cannot be null." if I don't pass a value. I know that DataList does not have an EmptyItem Property like a Gridview control. I do not want the page to error if I don't pass a value. Need info to deal with empty values in a datalist.
Most websites have pointed me to this code to use:
<FooterTemplate>
<asp:Label ID="lblEmpty" Text="No Result" runat="server"
Visible='<%#boolean.parse(([b]list[/b].Items.Count=0).ToString())%>'>
</asp:Label>
</FooterTemplate>
The 'list' throws an error. The error is "Too few type arguments to 'System.COllections.Generic.List". I am not sure if the code is written in C# and that is what is causing the error. It seems that it should work but I can not figure out the 'list' error.
View 1 Replies
Jun 28, 2010
I'm doing some research on security and sitemaps in ASP.net and am unfortunately running short on time. I have not worked too much with ASP.net security so I'm not completely sure if I'm heading in the right direction.
Here is my problem:
I have a public website (i.e. on the internet) that will allow any user to sign up to. The website will be developed using ASP.net webforms. These users may create other users and assign these users different roles.
Different roles have different restrictions and the menu is displayed appropriately. For example, a user acting as an administrator can see all menu options. Whereas a limited user will only see some of these menu items.
There needs to be the ability for users on our end to modify what pages certain roles can access. For example, if Role1 can do task X, we would like to be able at some point modify Role1 to no longer do task X. This would be done using an application built in-house.
User types (roles) are to be saved in the database. User permissions (what pages each type can have access to) are also to be saved saved in the database.
Here is something I am thinking of doing:
Implement the authorization and authentication set up built in to ASP.net using the web.config fileUse Sitemaps to dynamically create menus/breadcrumbs from the database
I believe it is possible to do the second one using custom providers (please correct me if I'm wrong). But I am not entirely sure if it's possible to configure the web.config file dynamically.
I suppose this is really more of a yes/no answer but I would just like to make sure I'm not going in the wrong direction. I will be using VS2008 and .net 3.5 framework.
View 1 Replies
Oct 7, 2010
I have a problem with binding a menu control to a sitemap file dynamically.
the files...
[code]
this files are into the 'tesorera' folder in the estructure of my project
When I run the project there aren't errors but I can't see the menu items of the sitemap file, I only see the 'siteMap' word in the menu .... why?
View 5 Replies
Nov 4, 2010
How would I programatically reference a .sitemap file that is not the root web.sitemap file? I have a file called research.sitemap in a folder a level under root. I want to refernce this file in my code behind like his: SiteMapNode m1 = SiteMap.RootNode (but since this isnt web.sitemap in the root, I dont know how to get access to it).
View 1 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
Jan 20, 2011
Possible Duplicate: linking to a radio button selection, asp.net c#
i have a page with a textarea and radio buttons. the text area is populated with data based on the radio button selection. i want the radio button selection to appear in the url so that a user can link to the radio button selection.
modify my querystring to include radio button value. here's the data caputered by fidler when i make a radio button selection.
[code]....
View 1 Replies
Nov 9, 2010
wrong with this?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim myText As TextBox = TryCast(DetailsView1.FindControl("TextBox2"), TextBox)
Dim QS = Request.QueryString("MenuLinkID")
[code]...
View 18 Replies
Oct 13, 2010
I'm wondering how I could update the querystring of my URL each time I hit the Next button of a Wizard control in order to show the ActiveStepIndex.
Example:
http ://ApplicationName/Default.aspx?Step=1
http ://ApplicationName/Default.aspx?Step=2
http ://ApplicationName/Default.aspx?Step=3
...
View 3 Replies
Apr 6, 2010
I want to dynamically populate a link with the URI of the current request, but set one specific query string parameter. All other querystring paramaters (if there are any) should be left untouched. Eg, imagine I want to build a link back to the current page, but with the querystring parameter "valueOfInterest" always set to be "wibble" (I'm doing this from the code-behind of an aspx page, .Net 3.5 in C# FWIW).Eg, a request for either of these two:
/somepage.aspx
/somepage.aspx?valueOfInterest=sausages
would become:
/somepage.aspx?valueOfInterest=wibble
And most importantly (perhaps) a request for:
/somepage.aspx?boring=something
/somepage.aspx?boring=something&valueOfInterest=sausages
would preserve the boring params to become:
/somepage.aspx?boring=something&valueOfInterest=wibble
Caveats: I'd like to avoid string manipulation if there's something more elegant in asp.net that is more robust. However if there isn't something more elegant, so be it. I've done (a little) homework: I found a blog post which suggested copying the request into a local HttpRequest object, but that still has a read-only collection for the querystring params. I've also had a look at using a URI object, but that doesn't seem to have a querystring
View 3 Replies
Apr 6, 2010
I am develop a webservice for user have to simple enter a url of website and it must generate a sitemap.xml for that particular website.
I have used GoogleSiteMapProvider but gives only local website Sitemap not any other.
View 3 Replies
Oct 6, 2010
I am creating a CacheDependency on the file that my SiteMap provider uses. I would like to get the name of the file from my sitemap provider instead of hard coding it. Is there a way?
Edit
Duh, I forgot to mention: XmlSiteMapProvider that comes with ASP.NET
Edit 2
Reflector shows a private member field called _filename that isn't exposed in any way as far as I can tell.
View 1 Replies
Jul 31, 2010
specify a querystring to be always null when there is no value to pass?I always get an error saying NULL can't be converted to INT.The SQL datatype for this querystring is int.
View 5 Replies
Jun 25, 2012
How to check the query string value null, if null then display the default value instead of object reference error.
View 1 Replies
Sep 22, 2010
I have a Master Page as well as a standard Web Form aspx file. What if I wanted to dynamically modify the complete HTML markup in an aspx file (perhaps based on a conditional statement - perhaps in a specific content place holder), how would I go about doing this? Sorry I'm coming from a PHP background so this is why I'm asking such a simple question.
View 1 Replies
Sep 9, 2010
I am simply trying to get a querystring value and pass it to a textbox in a formview with the default view set to edit mode.
Protected Sub fv_Detach_Engine_DataBound(ByVal sender As Object, ByVal e As EventArgs) Handles fv_Detach_Engine.DataBound
If fv_Detach_Engine.CurrentMode = FormViewMode.Edit Then
Dim tbx_IDProfileAccount As TextBox = TryCast(fv_Detach_Engine.FindControl("tbx_IDProfileAccount"), TextBox)
If tbx_IDProfileAccount Is Nothing Then
tbx_IDProfileAccount.Text = Request.QueryString("IDProfileAccount")
End If
End If
End Sub
View 3 Replies
Apr 20, 2010
I have a menu of products which are created at runtime from the database and populated into menu control.
But i need to also create a sitemap and display when the relevant menu or submenu item is selected
View 1 Replies
Dec 13, 2010
I want to add/edit available siteMap providers in web.config file from code behind.
I am using the siteMap providers currently in the application web.config in a format given below:
<siteMap>
<providers>
<add siteMapFile="~/App_Themes/MyAppDefault/MySiteMap.sitemap"
name="MyAppDefault" type="System.Web.XmlSiteMapProvider" />
</providers>
</siteMap>
This is allowing my application user to show up a different Site Map as and when the theme is changed.
But when I tried to do the same with the following code I faced with an issue.
configuration = WebConfigurationManager.OpenWebConfiguration("~")
section = CType(configuration.GetSection("system.web/siteMap"), SiteMapSection)
Dim provider As New ProviderSettings()
If Not section Is Nothing Then
provider.Name = txtError.Text
provider.Type = "System.Web.XmlSiteMapProvider"
section.Providers.Add(provider)
configuration.Save()
End If
This code is not allowing a provider.siteMapFile property (provideer is the ProviderSettings object).
As well the maximum possible way I can add a new SiteMap provider in web.config is as follows
<siteMap>
<providers>
<add name="MyAppCustom" type="System.Web.XmlSiteMapProvider" />
</providers>
</siteMap>
If anybody can suggest a way for me to add/edit the 'siteMapFile' attribute of the provider.
View 1 Replies
Jan 27, 2010
I want to dynamically add the value of query string, taking inputs from the database and thus building a link. I want this to work in an ASPX page.
Here is the snippet of what I want to achieve:
<asp:HyperLink NavigateUrl=""></asp:HyperLink>
Here I want to dynamically build the value of NavigatUrl, I tried doing this;
<asp:HyperLink NavigateUrl="Welcome.aspx?q=" + <%= Value From My Code Behind %>></asp:HyperLink>
However, this doesn't seem to work properly.
View 4 Replies
Mar 24, 2011
next code works with no problem at all but, isn't there a more elegant way?
What I want is to show all records when querystring is null and only those
who match the criteria when querystring is not null.
[Code]....
View 3 Replies
Jan 5, 2010
I'm thinking there has to be an efficient and OO way to do this.
I have several textboxes on a data entry page. When I need to make a new entry, I have to clear the text field before making new entries and this has to be done for quite a number of textboxes and across several pages.
Is there a way to use the FindControl method to locate all textboxes on a page and clear their textfields probably using a loop of some sorts?
View 2 Replies
Oct 4, 2010
can anyone tell me how to create a sitemap dynamically from a database
cuz I have tried all the static generaors without any good result
View 4 Replies