Protected Sub FormView2_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView2.DataBound
If Page.IsPostBack = True Then
Dim t2 As TextBox = TryCast(FormView2.FindControl("tes"), TextBox)
Dim l1 As Label = TryCast(FormView2.FindControl("costLabel"), Label)
Dim b As Button = TryCast(Me.FormView2.FindControl("button1"), Button)
b.Attributes.Add("onclick", "return DisplayConfirmation(" & l1.Text & ",'" & t2.ClientID & "')")
End If
End Sub
the label and textbox can detect in javascript...
but if i use session, it can not detect in javascript. i don't know about the true code...
my code use session like this:
Protected Sub FormView2_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView2.DataBound
If Page.IsPostBack = True Then
Dim t2 As TextBox = TryCast(FormView2.FindControl("tes"), TextBox)
Dim l1 As Label = TryCast(FormView2.FindControl("costLabel"), Label)
Dim b As Button = TryCast(Me.FormView2.FindControl("button1"), Button)
Session("l") = l1
hardy
Member
350 Points
477 Posts
Re: javascript and label is firing in the formview with condition..
Jan 26, 2008 12:16 PM|LINK
okay... master.... [cool]
i have know you are good in english...
maybe i need to learn english from u while ask about asp.net problem... [:D]
okay... i can use label and textbox in javascript, but now, i am using session, but can not detetct in javascript.
my javascript:
<script type="text/javascript">
function DisplayConfirmation(cost,textboxid)
{
var s=document.getElementById(textboxid).value;
if(s>cost)
{
if(confirm('Are u sure'))
{
document.getElementById('<%=HiddenField1.ClientID%>').value = "true"
}
else
{
document.getElementById("<%=HiddenField1.ClientID%>").value = 'false'
}
}
else
{
}
}
</script>
my code in vb:
Protected Sub FormView2_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView2.DataBound
If Page.IsPostBack = True Then
Dim t2 As TextBox = TryCast(FormView2.FindControl("tes"), TextBox)
Dim l1 As Label = TryCast(FormView2.FindControl("costLabel"), Label)
Dim b As Button = TryCast(Me.FormView2.FindControl("button1"), Button)
b.Attributes.Add("onclick", "return DisplayConfirmation(" & l1.Text & ",'" & t2.ClientID & "')")
End If
End Sub
the label and textbox can detect in javascript...
but if i use session, it can not detect in javascript. i don't know about the true code...
my code use session like this:
Protected Sub FormView2_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView2.DataBound
If Page.IsPostBack = True Then
Dim t2 As TextBox = TryCast(FormView2.FindControl("tes"), TextBox)
Dim l1 As Label = TryCast(FormView2.FindControl("costLabel"), Label)
Dim b As Button = TryCast(Me.FormView2.FindControl("button1"), Button)
Session("l") = l1
b.Attributes.Add("onclick", "return DisplayConfirmation(" & Session("l").tostring & ",'" & t2.ClientID & "')")
End If
End Sub
it can not detect...
what should i change it?
thx...