Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Datalist selects Item after first click, but does apply the SelectedItemTemplate after the second click only

Reply
Thread Tools

Datalist selects Item after first click, but does apply the SelectedItemTemplate after the second click only

 
 
Dirk Meusel
Guest
Posts: n/a
 
      08-07-2003
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???
 
Reply With Quote
 
 
 
 
Dirk Meusel
Guest
Posts: n/a
 
      08-19-2003
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" <> wrote in message news:<#>...
> 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" <> wrote in message
> news: 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???

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Button OnClick does not fire on first postback, but does on second Janet Collins ASP .Net 0 01-13-2006 10:08 PM
Datalist SelectedItemTemplate problem Kim Sĝvsĝ Pedersen ASP .Net Web Controls 2 10-19-2005 08:34 PM
XSL newbie question: how do I only show the first or second item? Robby XML 4 10-11-2005 03:41 PM
SelectedItemTemplate does not show in datalist Raymond Du ASP .Net 1 12-05-2004 01:17 PM
asp:dropdownlist , Only Selects first Value Problem Harry ASP .Net 1 01-17-2004 10:56 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57