2016-08-15 4 views
0

テキストを含む<td>があります。テキストボックス, but not for `: ​​VB.netのコードの背後にあるテキストを取得する

<td width="60%" id="SpeciesName" runat = "server" ><b><%#showData(Container.DataItem, "Name")%></b></td> 

私は SpeciesName' from the code behind, and Add it in a String list. I was capable of doing so for ASPのInnerTextプロパティを取得しようとしています。ここ

は、事前にvb.net

Private Shared Function getInputValues(ByVal currItem As RepeaterItem) As List(Of String()) 

    Dim Input As String = "SpeciesName" 
    Dim alParams As New List(Of String())(1) 

       Dim txtCurrent As TableCell = CType(currItem.FindControl(lstInput), TableCell) 
       If txtCurrent.Text.Trim <> "" And txtCurrent.Text.Trim <> "0" Then 
        alParams.Add(New String() {Input, txtCurrent.Text.Trim, "int"}) 
       End If 
     Return alParams 
    End Function 

おかげで背後にあるコードをあります!

+1

:ここ

は、更新されたコードの後ろにありますか?すなわち、この部分、右 - '<%#showData(Container.DataItem、" Name ")%>'? – TheUknown

+0

@正確にわかる! – Wafae

+1

@TheUknown私はちょうどそれを解決しました。ありがとうございました! – Wafae

答えて

1

編集:私はちょうどこれを解決しましたが、これには2つの問題がありました。 1)txtCurrentは、TableCellではなくHtmlTableCellとして宣言する必要があります。

2)私はテキストを取得していないはずです。あなたは `SpeciesName`のInnerTextプロパティをしたい

Private Shared Function getInputValues(ByVal currItem As RepeaterItem) As List(Of String()) 

    Dim Input As String = "SpeciesName" 
    Dim alParams As New List(Of String())(1) 

       Dim txtCurrent As HtmlTableCell = CType(currItem.FindControl(lstInput), HtmlTableCell) 
       If txtCurrent.InnerText.Trim <> "" And txtCurrent.InnerText.Trim <> "0" Then 
        alParams.Add(New String() {Input, txtCurrent.InnerText.Trim, "int"}) 
       End If 
     Return alParams 
    End Function 
+0

に加えて、この解決策を1つ自分自身に – TheUknown

関連する問題