Click here to Skip to main content
15,914,488 members
Home / Discussions / C#
   

C#

 
GeneralStrang Error :( Pin
M Riaz Bashir7-Apr-08 3:41
M Riaz Bashir7-Apr-08 3:41 
GeneralRe: Strang Error :( Pin
Mike Dimmick7-Apr-08 4:28
Mike Dimmick7-Apr-08 4:28 
GeneralRe: Strang Error :( Pin
Luc Pattyn7-Apr-08 4:36
sitebuilderLuc Pattyn7-Apr-08 4:36 
GeneralRe: Strang Error :( Pin
M Riaz Bashir7-Apr-08 4:56
M Riaz Bashir7-Apr-08 4:56 
General[Message Deleted] Pin
M Riaz Bashir7-Apr-08 4:58
M Riaz Bashir7-Apr-08 4:58 
GeneralRe: Here is my codes Pin
Luc Pattyn7-Apr-08 5:43
sitebuilderLuc Pattyn7-Apr-08 5:43 
GeneralRe: Here is my codes Pin
M Riaz Bashir7-Apr-08 5:46
M Riaz Bashir7-Apr-08 5:46 
GeneralEvent handler for menu populated from database Pin
random47-Apr-08 3:32
random47-Apr-08 3:32 
Hi,
i have populated the menu in a Panel from database Big Grin | :-D . I want to know how do i catch the clicks on the menuitems Cry | :((

Below is the code for generating and populating menu items in a Panel. Please help!

private void PopulateMenu()<br />
{<br />
  DataSet ds = GetDataSetForMenu();<br />
  Menu menu = new Menu();<br />
<br />
  foreach (DataRow parentItem in ds.Tables["Categories"].Rows)<br />
  {<br />
    MenuItem categoryItem = new MenuItem((string)parentItem["CategoryName"]);<br />
    menu.Items.Add(categoryItem);<br />
<br />
    foreach (DataRow childItem in parentItem.GetChildRows("Children"))<br />
    {<br />
      MenuItem childrenItem = new MenuItem((string)childItem["ProductName"]);<br />
      categoryItem.ChildItems.Add(childrenItem);<br />
    }<br />
  }<br />
<br />
  Panel1.Controls.Add(menu);<br />
  Panel1.DataBind();<br />
}<br />
<br />
private DataSet GetDataSetForMenu()<br />
{<br />
  SqlConnection myConnection = new SqlConnection(GetConnectionString());<br />
  SqlDataAdapter adCat = new SqlDataAdapter("SELECT * FROM Categories", myConnection);<br />
  SqlDataAdapter adProd = new SqlDataAdapter("SELECT * FROM Products", myConnection);<br />
<br />
  DataSet ds = new DataSet();<br />
  adCat.Fill(ds, "Categories");<br />
  adProd.Fill(ds, "Products");<br />
  ds.Relations.Add("Children", <br />
     ds.Tables["Categories"].Columns["CategoryID"], <br />
     ds.Tables["Products"].Columns["CategoryID"]);<br />
  return ds;<br />
}


Thanks in advance for your help!

adi_nik

GeneralRe: Event handler for menu populated from database Pin
Mark J. Miller7-Apr-08 6:07
Mark J. Miller7-Apr-08 6:07 
GeneralRe: Event handler for menu populated from database Pin
random421-Apr-08 18:36
random421-Apr-08 18:36 
GeneralRe: Event handler for menu populated from database Pin
lsconyer7-Apr-08 6:51
lsconyer7-Apr-08 6:51 
Questionhow to access browser elements Pin
Senthil Palani7-Apr-08 3:06
Senthil Palani7-Apr-08 3:06 
QuestionFloating/Dockable form Pin
Noemi Katinka7-Apr-08 2:52
Noemi Katinka7-Apr-08 2:52 
GeneralRe: Floating/Dockable form Pin
lsconyer7-Apr-08 3:11
lsconyer7-Apr-08 3:11 
QuestionRegarding printing of Windows forms [modified] Pin
manikandanid7-Apr-08 2:23
manikandanid7-Apr-08 2:23 
GeneralDynamically add TabPages to my form depending on the number of worksheets in a spreadsheet Pin
Walaza7-Apr-08 2:18
Walaza7-Apr-08 2:18 
GeneralRe: Dynamically add TabPages to my form depending on the number of worksheets in a spreadsheet [modified] Pin
lsconyer7-Apr-08 2:32
lsconyer7-Apr-08 2:32 
GeneralRe: Dynamically add TabPages to my form depending on the number of worksheets in a spreadsheet Pin
darkelv7-Apr-08 4:14
darkelv7-Apr-08 4:14 
GeneralRe: Dynamically add TabPages to my form depending on the number of worksheets in a spreadsheet Pin
Walaza7-Apr-08 4:54
Walaza7-Apr-08 4:54 
GeneralRe: Dynamically add TabPages to my form depending on the number of worksheets in a spreadsheet Pin
lsconyer7-Apr-08 5:07
lsconyer7-Apr-08 5:07 
GeneralRe: Dynamically add TabPages to my form depending on the number of worksheets in a spreadsheet Pin
Walaza7-Apr-08 5:59
Walaza7-Apr-08 5:59 
GeneralRe: Dynamically add TabPages to my form depending on the number of worksheets in a spreadsheet Pin
lsconyer7-Apr-08 6:57
lsconyer7-Apr-08 6:57 
GeneralRe: Dynamically add TabPages to my form depending on the number of worksheets in a spreadsheet Pin
Walaza7-Apr-08 20:31
Walaza7-Apr-08 20:31 
GeneralRe: Dynamically add TabPages to my form depending on the number of worksheets in a spreadsheet Pin
lsconyer8-Apr-08 0:37
lsconyer8-Apr-08 0:37 
GeneralRe: Dynamically add TabPages to my form depending on the number of worksheets in a spreadsheet Pin
Walaza8-Apr-08 2:52
Walaza8-Apr-08 2:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.