By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,972 Members | 1,115 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,972 IT Pros & Developers. It's quick & easy.

Please helppppppppppppppppp checkbox in datalist

P: n/a
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.DataIte m, "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.DataI tem, "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
Nov 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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/20...oppingCart.asp

Regards
Ashish M Bhonkiya

"mahsa" <an*******@discussions.microsoft.com> wrote in message
news:79**********************************@microsof t.com...
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.DataIte m, "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.DataI tem,
"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 page
I want if user click on the check box immidiatly textbox of price and quantity will fill
or maybe you have another idea I want to make shopping cart

Nov 18 '05 #2

P: n/a
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.DataIte m, "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
Nov 18 '05 #3

P: n/a
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" <an*******@discussions.microsoft.com> wrote in message
news:08**********************************@microsof t.com...
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 this.CheckBox1.CheckedChanged += new System.EventHandler(this.CheckBox1_CheckedChanged) ;
or if I use
<input type="checkbox" id="cbItem" runat="server" onclick="test(this)"

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

Nov 18 '05 #4

P: n/a
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" <an*******@discussions.microsoft.com> wrote in message
news:08**********************************@microsof t.com...
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 this.CheckBox1.CheckedChanged += new System.EventHandler(this.CheckBox1_CheckedChanged) ;
or if I use
<input type="checkbox" id="cbItem" runat="server" onclick="test(this)"

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

Nov 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.