P
psb
hello, I have a radio button list inside of a datalist... after finding the
radio button list, I do another lookup to populate the radio button list. I
have just made it to where the radio button list could affect price
depending on the option selected... I want to add a JavaScript:OnClick event
when the radio button that affects the price is clicked to pop an alert()
stating, "this will affect the price".
----------------------------------------
radList = CType(dlstProducts.Items(i).FindControl("radList"),
RadioButtonList)
radList.DataSource = objDataTable
radList.DataTextField = "OptionText"
radList.DataValueField = "ID"
radList.DataBind()
For j = 0 To objDataTable.Rows.Count - 1
If CLng(objDataTable.Rows(j)("PriceIncreasePercent")) <> 0 Then
lngPriceIncrease = CLng(objDataTable.Rows(j)("PriceIncreasePercent"))
radList.Items(j).Attributes.Add("onclick", "alert('increase price " &
lngPriceIncrease & "%');")
End If
Next
----------------------------------
The radio buttons get output perfectly, but the attribute to add the onclick
event is not there. it isn't even in the "View Source" of the document.
can attributes not be added to radio button list items?? I have also tried
building the radio button list manually with [[ radList.Items.Add(new
listitem("","")) ]] inside the for loop and same thing happens. I can't
belive this if it is true.
radio button list, I do another lookup to populate the radio button list. I
have just made it to where the radio button list could affect price
depending on the option selected... I want to add a JavaScript:OnClick event
when the radio button that affects the price is clicked to pop an alert()
stating, "this will affect the price".
----------------------------------------
radList = CType(dlstProducts.Items(i).FindControl("radList"),
RadioButtonList)
radList.DataSource = objDataTable
radList.DataTextField = "OptionText"
radList.DataValueField = "ID"
radList.DataBind()
For j = 0 To objDataTable.Rows.Count - 1
If CLng(objDataTable.Rows(j)("PriceIncreasePercent")) <> 0 Then
lngPriceIncrease = CLng(objDataTable.Rows(j)("PriceIncreasePercent"))
radList.Items(j).Attributes.Add("onclick", "alert('increase price " &
lngPriceIncrease & "%');")
End If
Next
----------------------------------
The radio buttons get output perfectly, but the attribute to add the onclick
event is not there. it isn't even in the "View Source" of the document.
can attributes not be added to radio button list items?? I have also tried
building the radio button list manually with [[ radList.Items.Add(new
listitem("","")) ]] inside the for loop and same thing happens. I can't
belive this if it is true.