Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Datalist selects Item after first click, but does apply the SelectedItemTemplate after the second click only (http://www.velocityreviews.com/forums/t61762-datalist-selects-item-after-first-click-but-does-apply-the-selecteditemtemplate-after-the-second-click-only.html)

Dirk Meusel 08-07-2003 12:57 PM

Datalist selects Item after first click, but does apply the SelectedItemTemplate after the second click only
 
Background:
On my webform a simple datalist shows one column. The databind is done
in the page_load event. In the ItemTemplate a linkbutton serves for
providing the Select Command.

Problem:
When I click a item to be selected, the datalist applies the
SelectedItemStyle on that Item, but not the SelectedItemTemplate. When
I click the same Item a second time asp.net applies both the
SelectedItemStyle and the SelectedItemTemplate, but does not fire the
OnSelectedItemChanged event.

What is to do to select the item with the first click properly???

Dirk Meusel 08-19-2003 09:56 AM

Re: Datalist selects Item after first click, but does apply the SelectedItemTemplate after the second click only
 
Thank you, Bülent Keskin! I forgot to databind the datalist after
postback again. with a databind() statement in the page_load event,
everything works fine.

Dirk


"Bülent Keskin" <bkeskin@luckyeye.com> wrote in message news:<#FUUmOPXDHA.1748@TK2MSFTNGP12.phx.gbl>...
> A good programming structure for DataGrids: (sorry for possible syntax
> errors..)
> ----------------------------------------------
>
> private void GridBind()
> {
> DataGrid1.DataSource = ....
> DataGrid1.DataBind();
> }
>
> public void Page_Load(object sender, EventArgs e)
> {
> if(!IsPostBack){
> GridBind();
> }
> }
>
> private void DataGrid1_SelectEvent....
> {
> DataGrid1.SelectedIndex = e.Item.ItemIndex;
> GridBind();
> }
>
> private void DataGrid1_PageChangeEvent....
> {
> DataGrid1.CurrentPageIndex = e.NewPageIndex;
> GridBind();
> }
>
>
> "Dirk Meusel" <dm2@rcs.urz.tu-dresden.de> wrote in message
> news:53b2e816.0308070457.47d51c1d@posting.google.c om...
> > Background:
> > On my webform a simple datalist shows one column. The databind is done
> > in the page_load event. In the ItemTemplate a linkbutton serves for
> > providing the Select Command.
> >
> > Problem:
> > When I click a item to be selected, the datalist applies the
> > SelectedItemStyle on that Item, but not the SelectedItemTemplate. When
> > I click the same Item a second time asp.net applies both the
> > SelectedItemStyle and the SelectedItemTemplate, but does not fire the
> > OnSelectedItemChanged event.
> >
> > What is to do to select the item with the first click properly???



All times are GMT. The time now is 12:40 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.