Hierarchical Menu Populated From Sqlserver Table?
May 13, 2010Hierarchical menu populated from sqlserver table?
View 2 RepliesHierarchical menu populated from sqlserver table?
View 2 RepliesSite.Master file contains
<ul id="nav">
<% Html.RenderAction("Menu", "ShoppingCart"); %>
</ul>
[ChildActionOnly]
public ActionResult Menu()
{
// for to geenrate menu ?
return ????
}
How to generate hierarchical menu below in Menu method from database data ? Should I use stringbuilder or is there better way ?
Resulting html shoudl look like:
[Code]....
Can I read from a dataset and create a hierarchical horizontal menu?
View 4 Replies I am experiencing is that when I try to populate a table on a online environment with the below code, the table is populated twice. With the same code the table is populated correctly on an offline/production environment and cannot understand why :
This is what I have:
The table is called Trips
Code Behind:
[Code]....
This is what I use in my .aspx page:
(removed for brevity...)
<script type="text/javascript">
since I am trying to find one googling but there is nothing apparently.
how to programmatically create an ASP.NET Menu Control populated using LINQ to SQL (with an unknown number of levels) and couldn't find one anywhere. It took me a while to figure out the logistics of it so I thought I would post my final solution so that you don't have to spend time figuring this out for yourself. Note that I am a self taught developer so I am potentially breaking any number standards coding protocols.
In this example I am working with an ASP.NET project named Virtual. Non-Standard NameSpaces are Virtual.(tools, components) etc...
1. Create your database table that will eventually be used to populate your menu control.
[Code]....
i have created menus using menucontrol (populated using database) its showing me menu items properly.now menu items goes out of screen (viewing area of the screen)i want to wrap that menu items means if the menu items goes out of the screen it will automatically shows the remaining menu items to the next line... and i have taken menucontrol in span tag..
View 2 RepliesI'm trying to update a row in a table in our sqlserver database i created (first time).I am getting this error, and what follows is the code. ExecuteNonQuery requires the command to have a transaction when the connection assigned to the command is in a pending local transaction. The Transaction property of the command has not been initialized.
[Code]....
Is there a quick way to query a database table in c# and push all the results into an arrayList?
View 3 RepliesI am trying to pull data from my populated javascript table. How do I pull the value from a javascript row? I am using
for (var i = 0; i < rowCount; i++) {
var row = table.rows[i];
//This is where I am having trouble
var chkboxIndicator = row.cells[0].childNodes[1];
alert(chkboxIndicator);
//
if (chkboxIndicator == indicator && Checkbox.checked == false) {
table.deleteRow(i);
rowCount--;
i--;
}
}
which has an alert message of "undefined". I tried .value and .text as well and no progress. How do I get the text from the childNodes?
i want store all the datas of xl sheet into sqlserver database table. i am using asp.net 2.0 and sqlserver 2005. pls provide the coding.
View 2 RepliesI am using asp.net3.5,sqlserver2008. I have retrieving data from Accounts,BUDGETS like this.
select a.AccountLink,a.Master_Sub_Account,b.* from Accounts a inner join BUDGETS b
on a.AccountLink=b.GLLink where a.AccountLink=1
output of my query...
AccountLink Master_Sub_Account GLLink AccType Budget01 Budget02 Budget03
[Code]....
i created a asp.net form for registration without using login controls and a table for storing information. the passwords in the password column in the table is clearly visible in text form i want it to be in encrypted form.
View 8 RepliesHow to inner join 2 table with primary key by no duplicate data in sqlserver 2008 ?
View 5 RepliesI am using vs2008, Sqlserver2008.
my table: PostGL having data like thi
AutoIdx TxDate Id AccountLink Description Debit Credit
3 2010-01-22 JL 2 bcb 0 35.09
5 2010-01-28 JL 2 g 3.51 0
select AutoIdx,TxDate,Id,AccountLink,Description,Debit,Credit,(Debit-Credit) as Actual from PostGL where Id='JL' and AccountLink=2
AutoIdx TxDate Id AccountLink Description Debit Credit Actual
3 2010-01-22 JL 2 bcb 0 35.09 -35.09
5 2010-01-28 JL 2 g 3.51 0 3.51
I am trying in view like this
declare @cnt int
declare @i int
set @budget=20
set @cnt= (select COUNT(*) from PostGL where AccountLink=2 )
set @i=1
WHILE (@i<=@cnt )
BEGIN
set @tdebit=??
END
I am taking count the no of rows having AccountLink=2
I need to read all debit,credit and add all debit into totaldebit,all credit into totalcredit independently from table.
then i need to show the totaldiff as Actual.
i need ....totaldiff=totaldebit-totalcredit
i am Using sql server 2005. i want to copy the data of the excel file to the table.
i wrote the query like :
INSERT INTO test(empId,empName,empMailId,empContactNo)
SELECT *
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C: estExcel.xls',
'SELECT * FROM [Sheet1$]')
got the following error :
SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure. For more information about enabling 'Ad Hoc Distributed Queries', see "Surface Area Configuration" in SQL Server Books Online.
then did this
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed Queries', 1;
GO
RECONFIGURE;
GO
again am trying the same above query ,now am getting the following error:
Msg 7399, Level 16, State 1, Line 1 The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" reported an error. The provider did not give any information about the error. Msg 7303, Level 16, State 1, Line 1 Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".
i want to copy the data of the excel sheet to the table.
Using VB as code-behind in asp.net page...I have a TABLE control which I'm building dynamically. After the table is built, I'm trying to retrieve the HEIGHT property of that table to be able to dynamically position the next elements on the form. However, this control property is coming back as blank every time.
How can I get the height of the TABLE control AFTER building it, so I known where to place the next few elements in the flow??
I'm using vwd 2008 express
I need to display a single field from an sqlserver table, do I need to use sqlDataSource ect. or is there a simpler way (like msaccess's LookUp) for single values.
I have a weird thing happening. I have two identical databases installed on one virtual machine but under two different instances of SQLServer. For some reason, periodically when saving from one it will save to the other instead. Using debug, I have verified that the connection string is correct and when the item saves, it still saves to the wrong database.I use session variable, and am of the belief that it might have something to do with it...and t hat when I go from one to the other it is still getting the connection string form the other for some reason.To make sure that it isn't a problem, I make sure that I completely close out one database before opening the other in a new IE window.I assume that when I completely close out an internet explorer window that it abandons all session states. Is that true?
View 7 RepliesOn my DetailsView for inserting, I have a field "manager code". When the user types in the code, I want another field "manager name" to be populated based on a lookup table in the database. I have done this on a FormView using code behind and "ontextchanged". How can I do this in DetailsView?
View 3 RepliesI was wondering if ther is a Way to select a table name from a DropDown Menu and then dispaly the data in say a GridView?
For Example;
In PHP you can post a Value to a Veriable and Put that Veriable into a SQL Statement.
"SELECT * FROM '.$VAR.'" would be the statment used to return the data.
I was wondering if there was a similar way to dot his. Currently I have a different page for each table with other dropdown menus to select other options, or would continuing to do it like i have just stated be better?
i want show menu as :
PCLaptop
MacIBMAsusAcer
Printer
HPCanon
So , how to create table in database ?
Anyone out there who can explain me how to prevent a menu control from being rendered as a table?
View 2 RepliesI have a situation where I'm using a single Masterpage and two Content Pages. The Master page basically contains a menu built using an HTML Table. The one Content Page contains the marjority of my site content. The way the menu works is that when user selects a menu item, a javascript function executes that evaulates which menu item was selected.
Now, this is where I'm not sure what to do next. Should I load the next Content Page in this javascript function or somewhere in the CodeBehind of the Content Page? I'm trying to find examples where I can load a page using Javascript but not having any luck.
I hate tables - don't want to use tables, unless I have tabular data to display. A menu is not tabular data (as far as I am concerned.) I was elated to see that in asp.net 4 - the menu control renders as a <ul> <li>, instead of as a table. However - try as I might, I can not get a horizontally orientated Menu to split into even columns, and text align center. FYI - I don't use fixed width - so I can't just set a width to 1000 - and separate it into even columns. Besides that, I want it to change width dynamically, based on the number of "columns (menuItems)" there are. Is it possible to spread out the <li> menu items evenly across the space I provide for them in their containing div or will I have to quite using menu controls, and start using JQuery Menu's?
View 2 RepliesI have a datatable which i get from the databasemanager class, and i would need to transform that data into a hierarchical structure
either binding it directly to a .net treeview control or in memory first .
i have an ID column, and a ParentID column.what i do not know necessarily is the parent ID to start with. so first thing to do would be to find out which node is the parent ID.
what would be best practice to loop over this table and make it hierarchical
BranchId ParentId ProductCount HasBranchChildren Name
0 NULL 48 1 Categories
1 0 20 1 CategoryA
2 1 10 1 CategoryA1
3 1 8 0 CategoryA2
4 1 2 0 CategoryA3
5 2 4 0 CategoryA1.1
6 2 6 0 CategoryA1.2
7 0 28 1 CategoryB
8 7 20 0 CategoryB1
9 7 8 0 CategoryB2
this would be an example datatable of course it will have hundreds of items, and it does not always start at the root node, its possible that with a request a certain subset of categories is requested, however i've talked with the database team and they will give me NULL on root nodes in the above example that would be element 0 in the table ....