This event DataList1_SelectedIndexChanged is only fired when MultiView1.ActiveViewIndex = 1 in the method LinkButton1_Click
I needed to change this value Session["frind1"] in LinkButton1_Click because the value in LinkButton.Text is string, I think that should is integer, occur an error of type because this value;
<div></div>
Kindly mark this post as "Answer", if it helped you.
pierrefrc
Participant
947 Points
201 Posts
Re: retrieving data in datalist from code behind
May 02, 2012 04:09 PM|LINK
Hi
I did any changes:
ASPX:
<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click" CommandName="select" Text='<%# Eval("friendname") %>' CommandArgument='<%# Eval("fid") %>'></asp:LinkButton>In CS
Session["frind1"] = Convert.ToInt16(((LinkButton)DataList1.Items[DataList1.SelectedIndex].FindControl("LinkButton1")).CommandArgument);Observations:
- This event DataList1_SelectedIndexChanged is only fired when MultiView1.ActiveViewIndex = 1 in the method LinkButton1_Click
- I needed to change this value Session["frind1"] in LinkButton1_Click because the value in LinkButton.Text is string, I think that should is integer, occur an error of type because this value;
<div></div>