Recursive Function For Hierarchically Data
Oct 30, 2010
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace amief.Models
{
public class WebsiteModels
{
public static void getPagesForPage(int pageId, dbDataContext db, List<page> myPages)
{
var pages = (from p in db.pages
where p.pageParent == pageId
select p);
foreach (var item in pages)
{
myPages.Add(item);
getPagesForPage(item.pageId, db, myPages);
}
}
}
}
calling the procudure
List<page> myPages = null;
WebsiteModels.getPagesForPage(0, db,myPages);
i'm getting an error System.NullReferenceException was unhandled by user code Message=Object reference not set to an instance of an object. on line "myPages.Add(item);" I don't understand the error...
View 2 Replies
Similar Messages:
Apr 25, 2010
how can i use cursor in this function ?
ALTER FUNCTION [dbo].[GetCatIDChilds]
(
@CatID [code].....
View 1 Replies
Jun 14, 2010
I am writing a program to crawl the websites. The crawl function is a recursive one and may consume more time to complete, So I used Multi Threading to perform the crawl for multiple websites. What exactly I need is, after completion crawling one website it call next one (which should be in Queqe) instead multiple websites crawling at a time.I am using C# and ASP.NET.
View 4 Replies
Apr 13, 2010
How do I bind data(comes from db) to tree view hierarchically?
Parent
--child1
--child1
--child2
--child1
--child2
--child1
View 1 Replies
Feb 20, 2011
I'm trying to implement a TreeView exactly like this:http://www.matthidinger.com/archive/2009/02/08/asp.net-mvc-recursive-treeview-helper.aspxThe problem is, that I'm using MySQL which doesn't support MARS (Multiple Active Result Sets).So, how would I do this, without being able to use MARS?
View 4 Replies
Jan 12, 2010
Not sure I'm asking the right question, but it's a start. I have a user control with a ListView and, ideally, I would like to nest this same control inside of the ListView to provide recursion. This would behave somewhat like a TreeView with child nodes. This might be a monumentally bad idea. :) In fact, I feed like MSFT is pointing me in that direction, because when I try this I am told that I can't do it
View 1 Replies
Mar 18, 2011
I have a categories table which is set up to allow an infinite number of sub category levels. I would like to mimic the following:It should be clarified that sub categories can have sub categories. E.g. Parent cat -> level 1 -> level 2 -> level 3 etc.My categories table has two columns, CategoryName and ParentID.This list box will be used when assigning the correct category to a product.How can I write this?EditIn response to thedugas I had to modify your answer to work with my situation. I found some errors that needed to be fixed, but below is a final, working solution.
protected void Page_Load(object sender, EventArgs e)
{
using (DataClasses1DataContext db = new DataClasses1DataContext())
[code]...
View 3 Replies
Mar 11, 2011
I use the following method to find a control on an asp.net page recursively:
/// <summary>
/// Searches recursively for a server control with the specified id parameter.
/// </summary>[code]...
I hit a problem because it was returning the wrong control. I tracked the problem down to the standard FindControl method, and fixed it by checking that the id of the control returned did actually match the one requested like this:
foundControl = start.FindControl(id);
if (foundControl != null && foundControl.ID == id)
return foundControl;
My question is why does start.FindControl(id) ever return a control that does not match the id requested?
View 1 Replies
Mar 23, 2010
When developing a rather complex web application that has to be localizable, it can be quite a dawnting task to make even the smallest change like changing a name for an abstract object type.To illustrate the problem, let's assume the user can create objects through our web application called a "FooBar". The web application most probably have numerous resource strings making reference to the object type "FooBar", for example, "Click here to create a new FooBar", or "Delete all the selected FooBars".During or even after the development life cycle of the web application, the owners decide that "FooBar" is not an appropriate name, and would like it to be renamed to "Thingamajic". In the web application there are thousands of references to "FooBar". Now one has to find all and replace them.
View 1 Replies
Mar 10, 2011
I'm looking for a good way to prevent the scenario of the page calling itself repeatedly.
I have a page, that to be rendered needs to make an HTTP request to an RSS feed. If the URL to that RSS feed happens to be the current page, it will fire off a request to itself. The new request would start off another request to the page, which would start another request... This continues until the site grinds to a halt when all available connections are busy in this recursive loop.
A few notes:
The URL to the RSS is entered by the user.
This is a page in a CMS, the URL of the page could be almost anything and could change after the RSS URL is entered.
In this case, the user entered a URL to a remote server that lead to a redirect back to the page.
A few ideas:
I could just deny all requests from the localhost IP before rendering.
Before sending the request, I could track in a common location which requests are active and not even send it if it's already in the middle of another request to the same address.
Maybe add a custom user-agent to the request header and deny the request if that user agent is seen?
View 1 Replies
Nov 21, 2010
I am using "Classified Ad" starter kit of Asp.net 2.0. In the Post Ad feature that using the ad "CategoryPath" control that recursively update link based on user select ad category. After user satisfied with the ad Category selection, the control generate a complete button link of the entire path.
If I am going to convert CategoryPath control from Asp.net to MVC / Ajax, how about I am going to do this?
View 1 Replies
Dec 4, 2010
basically trying to make a treeview.
i can query to get my parent list and pass that into the partial view. Im running into problems when i try and make a recurisve call to the view. i cant figure out how to pass the second group back in.
View 8 Replies
Sep 17, 2010
I added a new link to a master page on my website. Immediately after saving, I started getting this error:
Recursive fallback not allowed for character u003F. Parameter name: chars
I remove the new link and I still continue to get the error.
You can see this for yourself here:
[URL]
View 4 Replies
Feb 26, 2010
I am using a CustomSiteMapProvider to draw the SiteMap from a MS SQL database table. If I select all the rows in the SiteMap, everything works correctly. I now want to select a subsite from the SiteMap and display it and this subsite's subsites only. I am using recursive SQL to do this. The code below works correctly except the root record, record number 286, is not included in the result:
[Code]....
How do I include the root record, record ID 286, in the result?
View 5 Replies
Feb 8, 2011
I have created a server control which uses recursion to create a menu. It essentially outputs nested lists with anchors inside them.
Now, this works perfectly, however, since the control is calling itself to render the child menus, it is also rendering multiple identical WebResource.axd javascript file references in .
how to stop this from happening? I just want the one reference in my tag.
View 1 Replies
Jan 10, 2010
I Getting A Problem In DataGrid's ItemDataBound Event. I Am Calling A JavaScript Function In DataGrid's ItemDataBound Which Retrun The CellIndex And RowIndex Number On Which UserClick After That I Am Re-Binding The DataGrid With jQuery Function After That ItemDataBound Event Not Working. I Want To Call The Same Function Again. Is Their Any Method To Call A Server-Side Function On ItemDataBound Event Except Client-Side Function..
View 4 Replies
May 11, 2010
I have this import function which can be changed by the client in his desired way.Now I want to code such that if the client tries to import his own data on the page and doesnot give the tags in the order mentioned below his import function should be stopped.
It shouldn't make any changes unless the tags are in the right format because the problem now is if the tags are not in the right format when client changes then its importing over the existing files and directing to an error page which I dont want it should simply stop the import function if they are nt in the order.the code for this function is below
[code]....
View 7 Replies
Jan 5, 2010
i followed this link [URL] and i get selected value from dropdownlist using jquery
i created 3 partial views .
i need depend's on dropdownvalue redirect to partial page , so how can i implement in jquery with conditions?? or how can i implement in this function Public Function FetchData(ByVal dropdownValue As String) As ActionResult??
View 1 Replies
Mar 8, 2011
I would like to write a function to reuse some functionality that I repeat over and over...
For example:
[code]....
What's changing, in every field, is only the lambda function to get the current field to edit (Name, City, Address, etc...).
What is the best method? Or better: is there ANY method to extract a generic function?
View 18 Replies
Jan 27, 2010
<asp:LinkButton CssClass="button" ID="btnApply" runat="server" OnClick="btnApply_Click()" OnClientClick="Apply1('btnApply')" >
hi ihave this functin in .vb file
Protected Sub btnApply_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnApply.Click
end sub
and javascript function also in aspx
function ApplySummerization(id)
{
alert("hai");
}
View 4 Replies
Jan 1, 2010
I need to create something which is like an Add friend function in my website which works like this:
1) User types in name of the person he wants to search in the search field and clicks enter
2) on the same page, the search result will come out with an "add friend" button beside every name
3) when the user clicks the "add friend" button, he will be brought to another page (or pop up with a message box?) with a text message field to send to the friend, and a submit button to submit the friend request.
4) over at the Friend's page, he will be able to view the add friend request and decide whether to accept or deny the friend request.
View 1 Replies
Jan 26, 2011
Take the following scenario. I have multiple ASPX pages. Login, Logout, Main, Messages, etc... They all inherit from System.Web.UI.Page of course. For all the pages, I want to override the Render method from the Page class. I could easily copy and paste the same code into each page like so:
protected override void Render(HtmlTextWriter writer)
{
//Code Logic Here
}
But if I had many pages, lets say 20, maintaining the code in each page could get very time consuming and error prone.That made me think a bit and I thought okay lets try this...override the function in each page but call a static function. That way changing the static function would result in a change for every page.Which works fine... But its not really nice and clean, having to override like that on every single page.
View 3 Replies
Dec 3, 2010
i got a javascript function that i want to call on <aspImabutton onclient event but it keep saying function not defined.
[Code]....
View 2 Replies
Sep 1, 2010
can we integrate a c function or say can we use java orsay someother language function by using file handeling
View 2 Replies
Jun 8, 2010
Given the function
[code]....
When 'return false' is fired, I'm assuming that the function is stopped at that point and there's no need for exit fors and things like that?
View 1 Replies