Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Member
350 Points
477 Posts
Jan 22, 2008 04:10 PM|LINK
hello every one...
i have code like this:
<script language="javacsript" type="text/javascript"> function DisplayConfirmation() { var text = document.getElementById('<%=textbox1.ClientID%>').value; if(confirm('your money is'+text+' are u want to send it?')) { document.getElementById('<%=HiddenField1.ClientID%>').value = "true" } else { document.getElementById("<%=HiddenField1.ClientID%>").value = 'false' } } </script>
it can display msgbox with value textbox1..
but if i want to take value of label in gridview, how to put the label value from gridview to javascript?
my code like that:
var text = document.getElementById('<%=formview1.findcontrol("costLabel").ClientID%>').value;
but it's error "Object reference not set to an instance of an object."
my formview data:
<asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource4"> <ItemTemplate> harga: <asp:Label ID="costLabel" runat="server" Text='<%# Bind("cost") %>'></asp:Label><br /> no_order: <asp:Label ID="no_orderLabel" runat="server" Text='<%# Bind("no_order") %>'></asp:Label><br /> <asp:Button CommandName="clicke" EnableTheming="True" ID="Button1" runat="server" Text="click me" OnClick="Button1_Click1" /> <asp:Label ID="Label1" runat="server"></asp:Label> </ItemTemplate> </asp:FormView>
what should i change it?
thx...
hardy
Member
350 Points
477 Posts
how to pu the label from gridview to javascript?
Jan 22, 2008 04:10 PM|LINK
hello every one...
i have code like this:
<script language="javacsript" type="text/javascript">
function DisplayConfirmation()
{
var text = document.getElementById('<%=textbox1.ClientID%>').value;
if(confirm('your money is'+text+' are u want to send it?'))
{
document.getElementById('<%=HiddenField1.ClientID%>').value = "true"
}
else
{
document.getElementById("<%=HiddenField1.ClientID%>").value = 'false'
}
}
</script>
it can display msgbox with value textbox1..
but if i want to take value of label in gridview, how to put the label value from gridview to javascript?
my code like that:
var text = document.getElementById('<%=formview1.findcontrol("costLabel").ClientID%>').value;
but it's error "Object reference not set to an instance of an object."
my formview data:
<asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource4">
<ItemTemplate>
harga:
<asp:Label ID="costLabel" runat="server" Text='<%# Bind("cost") %>'></asp:Label><br />
no_order:
<asp:Label ID="no_orderLabel" runat="server" Text='<%# Bind("no_order") %>'></asp:Label><br />
<asp:Button CommandName="clicke" EnableTheming="True" ID="Button1" runat="server" Text="click me" OnClick="Button1_Click1" />
<asp:Label ID="Label1" runat="server"></asp:Label>
</ItemTemplate>
</asp:FormView>
what should i change it?
thx...