Click here to Skip to main content
15,909,437 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
C#
sb.Append("<div class='btn-box'><asp:Button Text='AddtoCart' runat='server' id='btnAddtoCard" + CategoriList[i].ProductId + "' class='btn btn-success' OnClick='AddPlanToCart_Click' /></div>");
sb.Append("<div class='product-info'>");
Posted
Updated 20-Nov-13 3:29am
v2
Comments
phil.o 20-Nov-13 9:28am    
What is the problem?
What is the question?
johannesnestler 20-Nov-13 10:07am    
doesn't make any sense for me... call ... event .. from StrinBuilder? I think it's lost in Translation what you meant. Can you try to describe your problem better or reformulate your question?
ZurdoDev 20-Nov-13 10:14am    
What?
Sergey Alexandrovich Kryukov 20-Nov-13 11:44am    
There is no such concept as "call an event"...
—SA
Rajib Mahata 20-Nov-13 12:20pm    
i WANT TO ADD ASP BUTTON ONCLICK EVENT INTO STRING BUILDER.BUT IT DOES NOT WORK .HOW CAN I DO THIS ?

1 solution

String Buider.append will just extend your string it will not display your button for that you have to create button object

System.Web.Ui namespace's Button Class u Can Use for that

Button b1=new Button();
b1.text="button Label";
b1.Id="ButtonId";

and from this button you can send request on that you can give your appropriate response

I hope that will Help
 
Share this answer
 
Comments
Rajib Mahata 20-Nov-13 12:33pm    
Button b=new Button();
b.Click += new EventHandler(b_Click);
b.Text = "click";
b.ID = "button2";
b.Visible = false;
sb.Append("<div class='btn-box'>");
sb.Append(b);
sb.Append("</div>");
but it don't working .
Nisarg Desai 25-Nov-13 2:51am    
is Your Button Appear On Page?
Rajib Mahata 25-Nov-13 10:46am    
thanks for reply ..

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