Hi guys,
Thanks for answering!
yes of course
Look at the Id values on the rendered HTML page. Are they what you expect them to be?
yes, in the html. But in the runtime asp code (below) they turn up as nothing, which means I canīt get to them in the code.
The creation of controls, this is page load:
Code:
Me.comCalc.Controls.Add(New LiteralControl("<input type=""checkbox"" onclick=""cl('" & pivrw.Item("SalID") & "')"" id=""" & pivrw.Item("SalID") & """ /><label id=""lb" & i & """ title=""" & pivrw.Item("SalID") & """ class=""comlabel"" type=""text"" style=""width:100px;color:black""/>" & Trim(pivrw.Item("SalTitle")) & "</label><div style=""clear:both""></div>"))
Me.comCalc.Controls.Add(New TextBox() With {.ID = "txb" & pivrw.Item("SalID"), .Text = Trim(pivrw.Item("SalID")), .CssClass = "cbtext"})
Me.comCalc.Controls.Add(New LiteralControl("<input id=""cp" & pivrw.Item("SalID") & """ type=""text"" value=""1"" runat=""server"" />"))
and then the fetching. itīs a button event (this gives id=nothing. it finds the controls and recognises them as literalcontrols):
Code:
For Each ctl As Control In Me.comCalc.Controls
If TypeOf ctl Is LiteralControl Then
If Left(ctl.ID, 2) = "cp" Then
Dim icp As New HtmlInputText
icp = ctl
Checkboxes(ctli) = CInt(icp.Value)
ctli = ctli + 1
End If
ctlindex = ctlindex + 1
End If
Next
and the javascript (this works, in that it changes the value from 1 to 0 and vice versa, allthough not in the html, but I guess thatīs not surprising)
Code:
function cl(salid) {
if (document.getElementById("cp" + salid).value == "0") {
document.getElementById("cp" + salid).value = "1"
}
else {
document.getElementById("cp" + salid).value = "0"
}
}
edit: itīs the "cp"-control I need to use the value of when I press the button.
Thanks again
Fuga.