购物车网站的必需代码 [英] required code for shopping cart website

查看:103
本文介绍了购物车网站的必需代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在开发一个购物网站.我的要求是,当我单击viewdetails(链接按钮)时,我想显示那些
其他页面中的特定详细信息.

请发送此代码.谢谢.

Hi,

I''m developing a shopping website. My requirement is that when i click on viewdetails(link button) I want to display those
particular details in another page.

Please send this code. Thankyou.

推荐答案



我希望您使用数据列表显示项目

这意味着linkbutton必须在数据列表控件中,就像下面的

Hi,

I hopw you are using datalist for displaying items

that means linkbutton must in datalist control so just like below

<asp:linkbutton id="fgdfg" runat="server" commandname="viewdet" commandargument="<%#Eval("itemid")" xmlns:asp="#unknown">View Details</asp:linkbutton>



之后,您必须使用datalist的itemcommand处理该linkbutton事件.



After that you''ve to handle that linkbutton event by using itemcommand of datalist

//under itemcommand event of datalist
if(e.commandname=="viewdet")
{
   response.redirect("viewdetails.aspx?itemid="+e.commandargument.tostring());
}



通过使用上面的代码,您可以将该项目ID发送到viewdetails aspx页面

在该页面中,您可以在pageload中检索有关该查询字符串的数据
并在详细视图中显示

我希望你能理解我说的话

最好的



By using above code you can send that item id to viewdetails aspx page

in that page you can retrieve data regarding that querystring in pageload
and display it in detailed view

I hopw you understood What I said

All the Best


用于将数据发送到其他页面的方法有很多.....

1)为此使用Querystring ...
2)会议
3)Cookies

您可以使用任何一种....

1)当您需要将一些参数类型数据传递到其他页面时,例如需要传递任何ID或名称,则可以使用查询字符串,然后可以使用类似这样的查询字符串来传递它...
For sending data to other page there is many ways.....

1) use a Querystring for it...
2) Session
3) Cookies

you can use any of this....

1) Query string is used when you need to pass some argument type data to other page like you need to pass any ID or name then you can pass it with use of query string like this...
Response.Redirect("~/test.aspx?ID=1");


并像这样在test.aspx页面中使用...


and use in test.aspx page like this...

string ID = Request.QueryString["ID"].toString();


http://www.dotnetperls.com/querystring [


http://www.dotnetperls.com/querystring[^]

2) Session is handle to store big amount of data so in your case if you create a data table in your memory for storing items which is user added to its selection and then directly you can add that data table to your session and use in your other page by converting session to data table like this....

//In Your Item Selection Page that is Items.aspx
Session["MyDataTable"] = dt;
Response.Redirect("~/ItemSelectionView.aspx");
//and then use it for displaying item in ItemSelectionView.aspx page
DataTable dt = (DataTable)Session["MyDataTable"];
//then use dt as your display control's datasource..... like this...
GridView1.DataSource = dt;
GridView1.DataBinding();


http://msdn.microsoft.com/en-us/library/ms178581.aspx [ ^ ]

3)或者Cookie用于在客户端存储数据,您还可能需要在Cookie中写入数据,并且在显示时需要从中读取数据....
http://msdn.microsoft.com/en-us/library/ms178194.aspx [ ^ ]


http://msdn.microsoft.com/en-us/library/ms178581.aspx[^]

3) Or Cookie is used to store data at client side and you can also need to write data in Cookie and while displaying you need to read data from it....
http://msdn.microsoft.com/en-us/library/ms178194.aspx[^]


这篇关于购物车网站的必需代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆