Welcome Guest Search | Active Topics | Sign In | Register

use of EO.Web controls Options
giancarlo
Posted: Thursday, October 4, 2007 6:19:49 AM
Rank: Newbie
Groups: Member

Joined: 10/4/2007
Posts: 2
Good Morning,
I'm a web developer from italy.
Today i downloaded your library for web menu and controls for aspnet 2.0 and i try to work them in my web projects.
The answer is this:

How can i put dimanically in code behind a parameter for linking a submenu of a product voice to a (for example a detailproducts.aspx?idproduct=datarow[idprodotto].ToString();).

This is a sample code from me generated for a test:

private DataSet CreateDataSet()

{

SqlConnection sqlConnection = new SqlConnection(ConfigurationManager.AppSettings["connessione"]);

string sql = "Select * from categories";

SqlDataAdapter sqlAdapter1 = new SqlDataAdapter(sql, sqlConnection);

DataSet ds = new DataSet();

sqlAdapter1.Fill(ds, "categories");

DataTable t = ds.Tables[0];

t.PrimaryKey = new DataColumn[] { t.Columns["categoryid"] };


string sql1 = "Select * from products";

SqlDataAdapter sqlAdapter2= new SqlDataAdapter(sql1, sqlConnection);

sqlAdapter2.Fill(ds, "products");

DataTable t1 = ds.Tables[1];

t1.PrimaryKey = new DataColumn[] { t1.Columns["productid"] };



DataColumn parentcolumn = t.Columns["categoryid"];

DataColumn childcolumn = t1.Columns["categoryid"];

DataRelation r = ds.Relations.Add(parentcolumn, childcolumn);

r.Nested = true;




return ds;

}



protected void Page_Load(object sender, EventArgs e)

{

DataSet mainDs = CreateDataSet();

Menu1.DataSource = mainDs;

Menu1.DataFields = "nomecategoria|nomeprodotto";

EO.Web.DataBinding dataBinding = new EO.Web.DataBinding();

dataBinding.Depth = 1;

// dataBinding.DataField = "details.aspx.aspx?id={0}";

// dataBinding.Property = "NavigateUrl";

Menu1.Bindings.Add(dataBinding);

Menu1.DataBind();

}



I hope you understand my problem

Best Regards

eo_support
Posted: Thursday, October 4, 2007 6:28:57 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

One way to do it is to handle ItemDataBound event. Inside that event you can then do something similar to this:

Code: C#
DataRowView dataRow = 
    (DataRowView)Menu1.DataItem; 
e.MenuItem.NavigateUrl = 
    string.Format("details.aspx.aspx?id={0}", dataRow["idprodotto"]);


Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.