Click here to Skip to main content
15,867,851 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
hello everybody, can you tell me please how to use the
System.Collections.Generic.List
in asp.net profile.please help me to solving my this issue.
Posted
Comments
[no name] 28-Oct-14 4:38am    
Could you explain what exactly are you trying to achieve ?
AnoopGharu 28-Oct-14 4:59am    
Actually I am working on the simple shopping website and now I am working on the cart_page and I trying to make cart_page by using the asp.net profile.Even I already write the code to enter the one product in the profile.But if the user has to need to enter the number of products.Then the problem will be occur so that's the reason I want to use the Generics List in the profile.
Here's below is the code to enter the one product in using profile:

Web.config:-

<profile automaticSaveEnabled="false" >
<properties>
<add name="Id" type="int" allowanonymous="true">
<add name="Name" type="String" allowanonymous="true">
<add name="ImageUrl" type="String" allowanonymous="true">
<add name="Price" type="int" allowanonymous="true">
<add name="Item" type="int" allowanonymous="true">
</properties>
</profile>

This is the coding of Cart_page.
ProfileShopcart.aspx.cs:-

public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
((Label)DataList1.Controls[0].FindControl("LblName")).Text = (Profile.Name).ToString();
((Image)DataList1.Controls[0].FindControl("Image1")).ImageUrl = (Profile.ImageUrl).ToString();
(((TextBox)DataList1.Controls[0].FindControl("TxtItem")).Text) = (Profile.Item).ToString();
(((Label)DataList1.Controls[0].FindControl("LblPrice")).Text) = (Profile.Price).ToString();
Profile.Save();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Profile.Name = ((Label)DataList1.Controls[0].FindControl("LblName")).Text;
Profile.ImageUrl = ((Image)DataList1.Controls[0].FindControl("Image1")).ImageUrl;
Profile.Item = int.Parse(((TextBox)DataList1.Controls[0].FindControl("TxtItem")).Text);
Profile.Price = int.Parse(((Label)DataList1.Controls[0].FindControl("LblPrice")).Text);
string ProductID = (Request.QueryString["ProductID"]);


Profile.Save();
}

}

So please help me about how to use the System.Collections.Generic.List in asp.net profile.
Maciej Los 28-Oct-14 12:25pm    
I'd suggest to post it as a question. Use "Improve question" widget!
Maciej Los 28-Oct-14 5:03am    
Issue? I haven't see any issue...
AnoopGharu 28-Oct-14 5:08am    
You are right sir,there is no issue I want to do it using the Generics List, So how it can be possible.I don't know how I need to declare the Generics List in the asp.net profile about to solving this issue.

1 solution

You use it as in any other place. Google, as always, helps[^].
 
Share this answer
 
Comments
AnoopGharu 28-Oct-14 5:04am    
Sir I had to try all the possible way,but still unable to do it with a proper manner.Can you please give me the appropriate example or solution.
Maciej Los 28-Oct-14 12:22pm    
Vague question, obvious answer ;)
+5!
CPallini 28-Oct-14 12:31pm    
Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900