Hi,i actualy want to do the same thing as (caloggins) said in his last
message that is:-
"If you actually need to do some processing of data
before the redirect, then you can pass the data key through the
CommandArgument field."
i actualy want that datakey, in the click event, of that linkbuton
which was clicked.
Protected Void LnkBtn_Click(----,----)
{
//here i want that key,and then i redirect to this url, from
(lnkbtn) click event, not from
//(DataList1_ItemCommand) event.
Response.Redirect(~/BookDetail.aspx?BId=”+BId);
}
Cerebrus i have an idea, that is, y not to store that datakey in
viewstate, as u already got the datakey(of that row, from where the
lnkbtn was clicked) in "DataList1_ItemCommand event" and then use the
viewstate under the click event of lnkbtn.
Also i new about postbackurl,but i want this thing in code behind,the
purpose behind it is that,i actually want to pass two parameters as a
querystring to BookDetail.aspx,m gona take the first parametr from the
datakey of datalist and the second parameter from another logic.
Otherwise the PostBackUrl is a better approach to take that
datakey,from where lnkbtn was clicked,bcoz its code is simple i.e
<asp:LinkButton ID="lnkbtn" runat="server" Text="ViewDetail"
PostBackUrl='<%# DataBinder.Eval
(Container.DataItem,"BId","ViewBookDetail.aspx?BId={0}") %>' />
its a much easier thing to do,but i want the datakey in the click
event of the linkbtn.
Cerebrus,Chuck,Caloggins,Brandon u people can realy help me in this
regard by giving me a sample code as cerebrus gave that,because its
easier to make sense from code rather just by telling the
solution.Thanks to u ppl, u ppl are realy showing concerns over my
problem,Thanks alot.