473,769 Members | 2,100 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datalist selects Item after first click, but does apply the SelectedItemTem plate 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
SelectedItemSty le on that Item, but not the SelectedItemTem plate. When
I click the same Item a second time asp.net applies both the
SelectedItemSty le and the SelectedItemTem plate, but does not fire the
OnSelectedItemC hanged event.

What is to do to select the item with the first click properly???
Nov 17 '05 #1
1 2474
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" <bk*****@luckye ye.com> wrote in message news:<#F******* *******@TK2MSFT NGP12.phx.gbl>. ..
A good programming structure for DataGrids: (sorry for possible syntax
errors..)
----------------------------------------------

private void GridBind()
{
DataGrid1.DataS ource = ....
DataGrid1.DataB ind();
}

public void Page_Load(objec t sender, EventArgs e)
{
if(!IsPostBack) {
GridBind();
}
}

private void DataGrid1_Selec tEvent....
{
DataGrid1.Selec tedIndex = e.Item.ItemInde x;
GridBind();
}

private void DataGrid1_PageC hangeEvent....
{
DataGrid1.Curre ntPageIndex = e.NewPageIndex;
GridBind();
}
"Dirk Meusel" <dm*@rcs.urz. tu-dresden.de> wrote in message
news:53******** *************** ***@posting.goo gle.com...
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
SelectedItemSty le on that Item, but not the SelectedItemTem plate. When
I click the same Item a second time asp.net applies both the
SelectedItemSty le and the SelectedItemTem plate, but does not fire the
OnSelectedItemC hanged event.

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

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1720
by: Barry | last post by:
I have a three-level drilldown report. The top level is a DataList. When an item is selected, a new DataList is instantiated in the SelectedItem template. I'd like to have the same thing happen when going to the third level, but there's a catch. Depending on what's selected on the second level, the template for the third level will be different. I have played with the LoadTemplate method but cannot figure out how to apply my condition from...
4
3096
by: V. Jenks | last post by:
What seems like a simple thing is apparently not so straightforward? I have a datalist. Inside of that datalist is an <itemtemplate> secion which contains other server controls such as a label, a radiobuttonlist, etc. I'm driving myself insane trying to figure out how to get
2
2196
by: News | last post by:
Hi, I need help with datalist and linkbutton. I need a LinkButton to display in datalist if datafield "is_measure_customchecklist" in a db table set to true. Here is the code (in parts): <asp:DataList id="dtl1" runat="server"
3
2782
by: CVerma | last post by:
Hi, I have an embedded datagrid within a datalist. I am not able to perfrom paging in the datagrid. Any ideas? Here is my code: Here is my Simplegrid.cs file: using System; using System.Collections; using System.ComponentModel; using System.Data;
1
1782
by: Raymond Du | last post by:
Hi, I have the following templates inside a datalist: <SelectedItemTemplate> &nbsp;<%# Container.DataItem("Title") %> </SelectedItemTemplate> <ItemTemplate> &nbsp;<asp:LinkButton id="lnkAction" runat="server" cssClass="OtherTabs"><%# Container.DataItem("Title") %></asp:LinkButton>
0
921
by: rbutch | last post by:
i should have included the code in the first post. sorry. i've got this working but it returns the 'index' property whereas i'd like the value of what's in the property.i'll include the minimalist of code here <asp:datalist id="Datalist1" OnItemCommand="getSelected"> <SelectedItemTemplate> <asp:HyperLink ID="ot_job_id" Runat="server" /> </SelectedItemTemplate>
4
2629
by: News | last post by:
Hi, I need help with datalist and linkbutton. I need a LinkButton to be visible in datalist only on the condition when datafield "is_measure_customchecklist" in a db table set to true. Here is the code (in parts): <asp:DataList id="dtl1" runat="server"
1
3162
by: Jules | last post by:
We have a problem setting, actually resetting, the SelectedItemTemplate of a DataList control. Below is the ObjectDataSource and the DataList in .ASPX: <asp:ObjectDataSource ID="mySource" runat="server" SelectMethod="GetStageUsage" TypeName="SomeController"> </asp:ObjectDataSource> <asp:DataList ID="dl" runat="server" DataSourceID="mySource" DataKeyField="ID" OnItemCommand="dl_ItemCommand">
1
1587
by: Arpan | last post by:
The following code displays records from a SQL Server 7 database table in a DataList (when the page loads for the first time, all the records under the column named "FName" in the DB table are displayed as links which, when clicked, displays the records existing in the other columns corresponding to the link clicked): <%@ Page Language=VB Explicit="true" %> <%@ Import Namespace="System.Data" %> <%@ Import...
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10208
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10038
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9857
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8867
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5294
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2812
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.