Hi I'm really unable to convert my code to VB.net. It's an example of C# code. Let's try
protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
{
if (string.Equals(e.CommandName, "Opties"))
{
TextBox txtPriceLV = (TextBox)e.Item.FindControl("txtPriceLV");
Decimal.TryParse(txtActualPriceLV.Text.Trim(), out ActualPrice); // Here is the process you actually can get Data from Text Box
}
Protected Sub ListView1_ItemCommand(sender As Object, e As ListViewCommandEventArgs)
If e.CommandName = "Opties" Then
Dim txtPriceLV As TextBox = DirectCast(e.Item.FindControl("txtPriceLV"), TextBox)
' Here is the process you actually can get Data from Text Box
[Decimal].TryParse(txtActualPriceLV.Text.Trim(), ActualPrice)
End If
End Sub
Talha Ashfaque -- Code ShodePlease Mark as Answer if this post helps you!
Protected Sub ListView1_ItemCommand(sender As Object, e As ListViewCommandEventArgs)
If e.CommandName = "Opties" Then
Dim txtPriceLV As TextBox = DirectCast(e.Item.FindControl("txtPriceLV"), TextBox)
' Here is the process you actually can get Data from Text Box
[Decimal].TryParse(txtActualPriceLV.Text.Trim(), ActualPrice)
End If
End Sub
Still gives "" as value. And I wrote 2 in the textbox.
lordplazikov...
Member
195 Points
319 Posts
Textbox out of listview
Nov 23, 2012 01:27 PM|LINK
How do I get the value of the textbox of a selected row in a listview?
I tried this code:
Protected Sub ListView1_ItemCommand(ByVal sender As Object, ByVal e As ListViewCommandEventArgs) Handles ListView1.ItemCommand
If e.CommandName = "Opties" Then
Dim aantal As String = DirectCast(e.Item.FindControl("txtaantal"), TextBox).Text()
end if
end sub
He always gives the value 0 because the textbox has the standard textvalue of "0".
Then I change the value to 5 for example but it still gives the value 0.
Thanks in advance.
JDB
raju_mab
Member
559 Points
110 Posts
Re: Textbox out of listview
Nov 26, 2012 09:51 AM|LINK
Hi I'm really unable to convert my code to VB.net. It's an example of C# code. Let's try
protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e) { if (string.Equals(e.CommandName, "Opties")) { TextBox txtPriceLV = (TextBox)e.Item.FindControl("txtPriceLV"); Decimal.TryParse(txtActualPriceLV.Text.Trim(), out ActualPrice); // Here is the process you actually can get Data from Text Box }let me know if helpful to you. Thanks.
tjaank
Contributor
6688 Points
1204 Posts
Re: Textbox out of listview
Nov 26, 2012 11:57 AM|LINK
VB.NET version
Protected Sub ListView1_ItemCommand(sender As Object, e As ListViewCommandEventArgs) If e.CommandName = "Opties" Then Dim txtPriceLV As TextBox = DirectCast(e.Item.FindControl("txtPriceLV"), TextBox) ' Here is the process you actually can get Data from Text Box [Decimal].TryParse(txtActualPriceLV.Text.Trim(), ActualPrice) End If End SubPlease Mark as Answer if this post helps you!
lordplazikov...
Member
195 Points
319 Posts
Re: Textbox out of listview
Nov 26, 2012 12:30 PM|LINK
Still gives "" as value. And I wrote 2 in the textbox.
raju_mab
Member
559 Points
110 Posts
Re: Textbox out of listview
Nov 27, 2012 03:17 AM|LINK
Thanks. It that helpful to you?