itemdatabound

How to access datasource fields in an ASP.NET Repeaters ItemDataBound event?

大城市里の小女人 提交于 2019-12-20 09:49:36
问题 I have a Repeater control that is being bound to the result of a Linq query. I want to get the value of one of the datasource's fields in the ItemDataBound event, but I'm not sure how to do this. 回答1: You can use: e.Item.DataItem . Example: Repeater.ItemDataBound Event // This event is raised for the header, the footer, separators, and items. void R1_ItemDataBound(Object Sender, RepeaterItemEventArgs e) { // Execute the following logic for Items and Alternating Items. if (e.Item.ItemType ==

Retrieve RadGrid cell value in ItemDataBound - “Input string was not in a correct format.”

孤街浪徒 提交于 2019-12-13 04:45:33
问题 I am trying to set a CssClass based on a the comparison of two cell values in my radGrid. Both cells are formatted for currency {0:c} , so that when I compare them, I have a $ sign in the text string. I know how to parse a string to remove the $ sign, which is what I am doing. However, is there a way to get the raw text of the cell prior to formatting, so that I will not have this error? Here is my code: ASPX: <telerik:RadGrid ID="rgCISPartsInfo" DataSourceID="dsCISItem" AutoGenerateColumns=

How to access the current ItemType Item value from OnItemDataBound method of ListView?

拥有回忆 提交于 2019-12-11 09:27:25
问题 In aspx page: <asp:ListView ID="ListViewPosts" ItemType="Post" SelectMethod="ListViewPosts_GetData" runat="server" OnItemDataBound="ListViewPosts_ItemDataBound"> ... ... </asp:ListView> Code behind: protected void ListViewPosts_ItemDataBound(object sender, ListViewItemEventArgs e) { ... Post p = Item; //where Item stands for the current Post record in ListView. ... } If I have this ListView where in ItemType="Post" ; Post is a database table. How to access the current value of Item (which

how to check the checkbox inside the repeater at binding time accordingto value?

烂漫一生 提交于 2019-12-11 06:17:49
问题 I have a repeater and inside it i have a checkbox. Now i want to check it according to columns value(0/1). I have tried it through the itemDataBound event of the repeater. what its doing if the rows has value 1 then its checked all checkbox and if first checkbox is unchecked then its unchecked all. my code is:- ` <td align="center"> <asp:CheckBox ID="chk" runat="server" /> </td> </tr> </ItemTemplate> </asp:Repeater>` The ItemDataBound events code is :- protected void rp_ItemDataBound(object

How to only display certain images in a folder into a Repeater in ASP.NET

谁说我不能喝 提交于 2019-12-08 03:51:08
问题 I have a Repeater that takes all my images in a folder and display it. But what code changes must I make to only allow lets say Image1.jpg and Image2.jpg to be displayed in my repeater. I don"t want the repeater to display ALL the images in my folder. My Repeater <asp:Repeater ID="repImages" runat="server" OnItemDataBound="repImages_ItemDataBound"> <HeaderTemplate><p></HeaderTemplate> <ItemTemplate> <asp:HyperLink ID="hlWhat" runat="server" rel="imagebox-bw"> <asp:Image ID="imgTheImage" runat

ItemDataBound 'e.item.dataitem(“key”)' with ListView Control [duplicate]

橙三吉。 提交于 2019-12-07 16:28:40
问题 This question already has answers here : Get data being bound to ListView on DataBound event (4 answers) Closed 5 years ago . With the ASP.NET Repeater control, I am used to being able to access my data item values in the ItemDataBound Event Handler by doing: e.item.dataitem("column_name") However, it seems with the ListView control this is not possible. How can I access the data item values? 回答1: Get data being bound to ListView on DataBound event 来源: https://stackoverflow.com/questions

asp.net repeater - get value of row item _DataBound

时光怂恿深爱的人放手 提交于 2019-12-04 06:16:20
问题 how can I get the value of each cell that I want in a repeater _DataBound sub? - this is so I can change the value a little and apply the change to a literal 回答1: Let's say this is your repeater (since you didn't include any code): <asp:Repeater ID="_r" runat="server"> <ItemTemplate> <asp:Literal ID="_lit" Text='<%# Eval("yourItemName")%>' runat="server"></asp:Literal> <br /><br /> </ItemTemplate> </asp:Repeater> and you make an ItemDataBound event because you want to add "meow" to the end of

How to access datasource fields in an ASP.NET Repeaters ItemDataBound event?

爱⌒轻易说出口 提交于 2019-12-02 20:29:27
I have a Repeater control that is being bound to the result of a Linq query. I want to get the value of one of the datasource's fields in the ItemDataBound event, but I'm not sure how to do this. Brian Hedler You can use: e.Item.DataItem . Example: Repeater.ItemDataBound Event // This event is raised for the header, the footer, separators, and items. void R1_ItemDataBound(Object Sender, RepeaterItemEventArgs e) { // Execute the following logic for Items and Alternating Items. if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { if (((Evaluation)e.Item

asp.net repeater - get value of row item _DataBound

断了今生、忘了曾经 提交于 2019-12-02 10:09:49
how can I get the value of each cell that I want in a repeater _DataBound sub? - this is so I can change the value a little and apply the change to a literal Let's say this is your repeater (since you didn't include any code): <asp:Repeater ID="_r" runat="server"> <ItemTemplate> <asp:Literal ID="_lit" Text='<%# Eval("yourItemName")%>' runat="server"></asp:Literal> <br /><br /> </ItemTemplate> </asp:Repeater> and you make an ItemDataBound event because you want to add "meow" to the end of every literal (which otherwise will just show the value of yourItemName from the datasource): protected