TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
piya p
NA
84
48.1k
which parameters should be pass for bind property of image
Apr 10 2014 12:57 AM
In my application I am using following code
page1.aspx:
<asp:DataList ID="datalist" runat="server" RepeatColumns="5" RepeatDirection="Horizontal" >
<ItemTemplate>
<asp:ImageButton ID="IB_tn" runat="server" ImageUrl='<%# Bind("photo", "url1") Width="100px" Height="100px" CommandArgument='<%# Container.ItemIndex %>' />
</ItemTemplate>
<SelectedItemStyle BorderColor="Red" BorderWidth="1px" />
</asp:DataList>
page1.aspx.cs:
var objects = new JavaScriptSerializer().Deserialize<dynamic>(json);
Array arryobjects = new JavaScriptSerializer().Deserialize<dynamic>(json);
int mycount = arrobjects.Length;
for (int i = 0; i< mycount; i++)
{
filename_photo = objects[i]["filename"];
url1 = objects[i]["url"];
dtlist.DataSource = listItems;
dtlist.DataBind();
Photo photod = new Photo(photo, url1);
listItems.Add(photodetails);
}
and create a class:
public class photo
{
string photo { get; set; }
string url1 { get; set; }
public Photo(string photo, string url1)
{
this.photo = photo;
this.url1 = url1;
}
}
this code giving me run time error:
[System.Web.HttpException] = {"DataBinding: 'Photos.Photo' does not contain a property with the name 'url1'."} or
[System.Web.HttpException] = {"DataBinding: 'Photos.Photo' does not contain a property with the name 'photo'."}
can any one explain me what is wrong in my code?
Reply
Answers (
2
)
Cascading dropdownlist inside Gridview
Asp.net code for Uploading and playing video of any format ?