ASP.NET Menu && SiteMapDataSource
am 09.01.2008 23:04:16 von NvrBst
I have a couple questions. Firstly is there a way to set the style of
a MenuItem in the "MenuItem_MenuItemDataBound" event? Right now I
check to see if the e.Item is the last element and then set the
SeparatorImageUrl to a blue bar image I made. Slight problem with
this is that the bar has to be exactly the right length to match the
other borders. When I add new items I usally have to re-make the
separatorImage. It would be great if I could just do something like
"e.Item.Style = "border-bottom: solid thin blue;";" kind of thing.
Secondly, I used to have the ASPMenu coded with the "MenuItem"
properties. The navigation was always fast/instant when I clicked a
link. I just converted the menu items to the "Web.sitemap" file and
set the DataSourceID on the ASPMenu. Most the time its fast (0-1
second to move to the next page when I click). However, this one page
(which has a MSChart and uses a hidden iframe that constantly
postbacks to keep updating the data in the chart) takes anywhere from
2-15 seconds to move to any other link from the ASPMenu. When I
wasn't using the DataSourceID="SiteMapDataSource"; this didn't
happen. Is there something anyone could suggest trying to fix this?
(IE EnableViewState = false;) - Note ViewState = false didn't fix it.
I can see that the hidden IFrame is still updating the chart even
after I clicked the ASPMenu Item link to move to another page which is
the problem I'm pretty sure... Need to tell it to move immediatly
kind of thing when I click the link.
Thanks, If someone would like more info or such I can try to be more
detailed.
NB
Re: ASP.NET Menu && SiteMapDataSource
am 17.01.2008 21:04:24 von NvrBst
On Jan 9, 2:04=A0pm, NvrBst wrote:
> I have a couple questions. =A0Firstly is there a way to set the style of
> a MenuItem in the "MenuItem_MenuItemDataBound" event? =A0Right now I
> check to see if the e.Item is the last element and then set the
> SeparatorImageUrl to a blue bar image I made. =A0Slight problem with
> this is that the bar has to be exactly the right length to match the
> other borders. =A0When I add new items I usally have to re-make the
> separatorImage. =A0It would be great if I could just do something like
> "e.Item.Style =3D "border-bottom: solid thin blue;";" kind of thing.
>
> Secondly, I used to have the ASPMenu coded with the "MenuItem"
> properties. =A0The navigation was always fast/instant when I clicked a
> link. =A0I just converted the menu items to the "Web.sitemap" file and
> set the DataSourceID on the ASPMenu. =A0Most the time its fast (0-1
> second to move to the next page when I click). =A0However, this one page
> (which has a MSChart and uses a hidden iframe that constantly
> postbacks to keep updating the data in the chart) takes anywhere from
> 2-15 seconds to move to any other link from the ASPMenu. =A0When I
> wasn't using the DataSourceID=3D"SiteMapDataSource"; this didn't
> happen. =A0Is there something anyone could suggest trying to fix this?
> (IE EnableViewState =3D false;) - Note ViewState =3D false didn't fix it.
>
> I can see that the hidden IFrame is still updating the chart even
> after I clicked the ASPMenu Item link to move to another page which is
> the problem I'm pretty sure... =A0Need to tell it to move immediatly
> kind of thing when I click the link.
>
> Thanks, If someone would like more info or such I can try to be more
> detailed.
>
> NB
If anyone else runs into a simular problem with the slow navigation
the problem for me was fixed by switching the SiteMapDataSource to a
XMLDataSource with Cache'ing turn on. I guess the Menu was trying to
get the Web.sitemap file each time I navigated to a new page, and
since the MSChart page was constantly posting back then that
Web.sitemap request took longer than normal.
Cheers, NB