c# - How can I pass values of a listview from aspx page to another ? -
i working on class project creating listview in 1 .aspx page. can display database through list view cannot transfer value of selected item .aspx page another.
my designing code below:
<asp:listview id="lvpresent" runat="server" datasourceid="sqldatasource1" onitemdatabound="lvpresent_itemdatabound" > <layouttemplate> <table> <tr> <td></td> </tr> </table> <asp:placeholder id="itemplaceholder" runat="server"></asp:placeholder> </layouttemplate> <itemtemplate> <td> <asp:hyperlink id="hyperlink1" runat="server"> <asp:image id="imagebutton1" runat="server" imageurl='<%#eval("url")%>' height="200px" width="250px" /> </asp:hyperlink> </td> </itemtemplate> </asp:listview>
what should work done ?
to send url page can use querystring
. modify hyperlink
, add navigateurl
navigateurl='<%#"yournextpagename.aspx?imgurl="+ eval("url")%>'
just replace code:-
<asp:hyperlink id="hyperlink1" runat="server"> <asp:image id="imagebutton1" runat="server" imageurl='<%#eval("url")%>' height="200px" width="250px" /> </asp:hyperlink>
with
<asp:hyperlink id="hyperlink1" runat="server" navigateurl='<%#"yournextpagename.aspx?imgurl="+ eval("url")%>'> <asp:image id="imagebutton1" runat="server" imageurl='<%#eval("url")%>' height="200px" width="250px" /> </asp:hyperlink>
on page, can access image url this:-
string imgurl = request.querystring["imgurl"];
put image control in page assign image on page load, if image control id image1 can assign on page load of page this:-
image1.imageurl = imgurl
Comments
Post a Comment