Please helppppppppppppppppp checkbox in datalist

G

Guest

my problem dosent solve yet I want to have
claa void in onclick of my check bov if I us
function setProps ( )

msg.innerText = "llll";

in <datalist>
<ItemTemplate><input type="checkbox" id="cbItem" runat="server" onclick="test()

value='<%#DataBinder.Eval(Container.DataItem, "PartNo")%>' NAME="cbItem"><%#DataBinder.Eval(Container.DataItem, "PartNo")%><td class='item_content' width='83'><input value=4 maxLength='4' size='4' name='"qty_"+<%#DataBinder.Eval(Container.DataItem, "PartNo")%>'>Cartons</td><td class='item_content' width='76' vAlign='center' align='right'><p style='width:50px;'><span id='"subtotal_"+<%#DataBinder.Eval(Container.DataItem, "PartNo")%>'></span></td></ItemTemplate
it works but when i change it to c

<script language="c#"
void test ( )
msg.innerText = "llll"

</script
it say error oon pag
I want if user click on the check box immidiatly textbox of price and quantity will fil

or maybe you have another idea I want to make shopping cart
 
A

Ashish M Bhonkiya

Hi mahsa,

I really cannot understand your question. But if you are developing shopping
cart application you should take a look at the existing sample application
which are already available with free source code, dont know if u are aware.

Download the "Commerce Starter Kit"
http://www.asp.net/default.aspx?tabindex=9&tabid=47

From C-Sharp Corner
http://www.c-sharpcorner.com/Code/2004/April/ASPNetShoppingCart.asp

Regards
Ashish M Bhonkiya

mahsa said:
my problem dosent solve yet I want to have
claa void in onclick of my check bov if I use
function setProps ( ) {

msg.innerText = "llll";
}
in <datalist>:
<ItemTemplate><input type="checkbox" id="cbItem" runat="server" onclick="test()"

value='<%#DataBinder.Eval(Container.DataItem, "PartNo")%>'
NAME="cbItem"><%#DataBinder.Eval(Container.DataItem, "PartNo")%><td
class='item_content' width='83'><input value=4 maxLength='4' size='4'
name='"qty_"+<%#DataBinder.Eval(Container.DataItem,
"PartNo")%>'>Cartons</td><td class='item_content' width='76' vAlign='center'
align='right'><p style='width:50px;'><span
id='"subtotal_"+<%#DataBinder.Eval(Container.DataItem,
 
G

Guest

I have a datalist that show quantity price and some information in each row when user click oon checkbox it show in quantity 1 and calculate the price with the item he have already in shopping card my broblem is how can I do onselectedchange check bo

I want to have onselectedchange event for the check box in my datalist when I try to use it is makes error becouse the checkbox dynamicly in datalist and it dosent have
this.CheckBox1.CheckedChanged += new System.EventHandler(this.CheckBox1_CheckedChanged)

or if I us
<input type="checkbox" id="cbItem" runat="server" onclick="test(this)

value='<%#DataBinder.Eval(Container.DataItem, "PartNo")%>' NAME="cbItem"><%#DataBinder.Eval(Container.DataItem, "PartNo")%
instead of asp:checkbox it dosent work with my public void in serverside I confuse
I just want to have a check box in datalist that when it checked it call some voi
whats your Idea
 
A

Ashish M Bhonkiya

Hi mahsa,

You will not find the this.CheckBox1.CheckedChanged += new
System.EventHandler(this.CheckBox1_CheckedChanged); event as the checkbox is
a part of the datalist control, so whenever you do something with the
checkbox you will need to check in the DataList1_ItemCommand so whatever
action you are doing should be done in the ItemCommand of the datalist.
there you can loop thru the items in the datalist and get the checkbox
control using the FindControl method and check if the checkbox is checked
then ( do the necessacary processing to update your cart).

This should give you some idea of what changes you need to do and where, i
cannot help you with the code.

Regards
Ashish M Bhonkiya


mahsa said:
I have a datalist that show quantity price and some information in each
row when user click oon checkbox it show in quantity 1 and calculate the
price with the item he have already in shopping card my broblem is how can I
do onselectedchange check box
I want to have onselectedchange event for the check box in my datalist
when I try to use it is makes error becouse the checkbox dynamicly in
datalist and it dosent have
 
R

Rick Spiewak

You should put this in the code-behind, not on the page. Then, in the
pageload event when it is a postback, check for the datalist edititem <> -1.
Find the checkbox, and add the eventhandler there.

mahsa said:
I have a datalist that show quantity price and some information in each
row when user click oon checkbox it show in quantity 1 and calculate the
price with the item he have already in shopping card my broblem is how can I
do onselectedchange check box
I want to have onselectedchange event for the check box in my datalist
when I try to use it is makes error becouse the checkbox dynamicly in
datalist and it dosent have
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,144
Latest member
KetoBaseReviews
Top