see the attachment i have bind image in radlistview ,
after that which image i click that image how i get that id
<telerik:RadListView ID="RadListViewAttachment" runat="server" ItemPlaceholderID="ListViewContainer" OnNeedDataSource="RadListViewAttachment_NeedDataSource" DataKeyNames="RecordID" OverrideDataSourceControlSorting="true"> <LayoutTemplate> <asp:PlaceHolder runat="server" ID="ListViewContainer" /> </LayoutTemplate> <ItemTemplate> <table> <tr> <td> <telerik:RadBinaryImage Style="cursor: pointer; display: block;" runat="server" ID="RadBinaryImage1" AutoAdjustImageControlSize="false" Width="15px" Height="15px" DataValue='<%#Eval("SaveFile") %>' AlternateText="<%$ Code:Resources.Articles.Article_LargeImage %>" ToolTip="<%$ Code:Resources.Articles.Article_LargeImage %>" onclick="<%#CreateWindowScript() %>" /> </td> <td> <label> <%#Eval("OrgFileName")%></label> </td> </tr> </table> </ItemTemplate> </telerik:RadListView>See the attachment.
Thanks Advance,
Mohideen.
8 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 31 Aug 2012, 07:24 AM
Hi,
I am not quite sure about your requirement. I suppose you want to access the RadBinaryImage in ItemTemplate. Here is the sample code.
C#:
Thanks,
Princy.
I am not quite sure about your requirement. I suppose you want to access the RadBinaryImage in ItemTemplate. Here is the sample code.
C#:
protected void RadListView1_ItemDataBound(object sender, RadListViewItemEventArgs e){ if (e.Item is RadListViewDataItem) { RadBinaryImage img = (RadBinaryImage)e.Item.FindControl("RadBinaryImage1"); }}Thanks,
Princy.
0
New
Top achievements
Rank 1
answered on 01 Sep 2012, 06:52 AM
After i click that goes another form ,
It's load on page load only after i click that button it's not come on this page ,
It's goes on another form.
Thanks Advance,
Mohamed.
It's load on page load only after i click that button it's not come on this page ,
It's goes on another form.
protected string CreateWindowScript(){ //return string.Format("var win = window.radopen('LargerImage.aspx?id={0}','Details');win.center();", attachmentrowid); return string.Format("ShowImage('" + attachmentrowid + "');");}function ShowImage(arg) { var RadWindow = $find("<%=Details.ClientID%>"); RadWindow.setUrl("LargerImage.aspx?id=" + arg); RadWindow.show(); false; }Thanks Advance,
Mohamed.
0
Hello Mohamed,
Inside the "<%#" tag you can use the Container (that will be the current item) to pass it to the CreateWindowScript function then use it to get the dataitem ID.
//......
Greetings,
Vasil
the Telerik team
Inside the "<%#" tag you can use the Container (that will be the current item) to pass it to the CreateWindowScript function then use it to get the dataitem ID.
<%#CreateWindowScript(Container) %>" />protected string CreateWindowScript(object Container){}Greetings,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
0
Hello Mohamed,
You need to cast it to RadListViewItem in order to access the class properties.
Don't forget to include the Telerik.Web.UI in order to cast successfully.
Regards,
Vasil
the Telerik team
You need to cast it to RadListViewItem in order to access the class properties.
(Container as RadListViewItem).DataItem.FileID;//orRadListViewItem item = (RadListViewItem)Container;return item.DataItem.FileID;Don't forget to include the Telerik.Web.UI in order to cast successfully.
Regards,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
New
Top achievements
Rank 1
answered on 04 Sep 2012, 04:32 AM
Thanks For your reply ,
See the attachment error
Thanks Advance,
Mohamed.
See the attachment error
Thanks Advance,
Mohamed.
0
Accepted
Hello Mohamed,
It was my mistake, try to cast to RadListViewDataItem, not RadListViewItem.
Kind regards,
Vasil
the Telerik team
It was my mistake, try to cast to RadListViewDataItem, not RadListViewItem.
Kind regards,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
New
Top achievements
Rank 1
answered on 04 Sep 2012, 07:15 AM
Thanks For your Help Vasil .
I getting Like That
Thanks Advance ,
Mohamed.
RadListViewDataItem RDListitem = (RadListViewDataItem)Container;//return RDListitem.DataItem.FileID;string Val = RDListitem.DataItem.ToString();string File = Val.Substring(11, 5);string[] FileIDArray = File.Split(',');string FileI = FileIDArray[0]; return string.Format("ShowImage('" + FileI + "');");Thanks Advance ,
Mohamed.