check box in datalist

G

Guest

hi I want to use a check box in datalist when user checked the check box price will be shown in the textbox in the same row in datalist do you have any idea
<input onclick="test()" style='border:0px;' type='checkbox' name='"add_" +<%# DataBinder.Eval(Container.DataItem, "PartNo") %>' id='<%# DataBinder.Eval(Container.DataItem, "PartNo") %>'
I use this but when i check the check box it say error on pagedo you know any sampl
 
R

Rick Spiewak

You'll need to add an event handler to the check box. Do this in the page
load postback event if the edititem index <> -1. Use a template so you'll
have an ID to use to find the control. In the event handler, similarly, find
the textbox and put the value into it.

mahsa said:
hi I want to use a check box in datalist when user checked the check box
price will be shown in the textbox in the same row in datalist do you have
any idea?
 
G

Guest

hi
I try to add event handler to page but the checkbox will add in datalist so it dosent know check box at this time
 
R

Rick Spiewak

Then add the event handler when you add the checkbox - but be aware that
dynamically added controls have to be re-created on every postback! You
should define the checkbox in the edit item template.

mahsa said:
hi,
I try to add event handler to page but the checkbox will add in datalist
so it dosent know check box at this time
 
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 fill
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top