私はVBウェブフォームのデータリストを持っています。vbのデータリスト。データリスト内の行またはセルの特定の値を取得しようとしています
データリストの特定の行とセルで値を取得するにはどうすればよいですか?
詳細ビューではできますが、データリストではどうすればいいですか?
は下記たDetailsViewのために私のコードです:
Dim selectedCommentAns As String = DetailsView.Rows(0).Cells(1).Text
私はデータリストのために同じ方法を試してみましたが、それは行とセルを選択する必要がいけません。
これは私のデータリストのASPマークアップです:
<asp:DataList ID="DataListPhotoGallery" runat="server" CellPadding="5"
CellSpacing="12" DataKeyField="PhotographerPhotoId"
DataSourceID="SqlDataSourcePhotoGallery" RepeatColumns="3">
<ItemTemplate>
<asp:Image ID="Image1" runat="server" BorderColor="#C7B273"
BorderStyle="Groove" BorderWidth="12px" Height="200px"
ImageUrl='<%# Eval("PhotographerPhotoImgPath", "images/UserUploadedPhoto/{0}") %>'
Width="220px" />
<br />
Photo No:
<asp:Label ID="PhotographerPhotoIdLabel" runat="server"
Text='<%# Eval("PhotographerPhotoId") %>' />
<br />
Photo Description:
<asp:Label ID="PhotographerPhotoDescLabel" runat="server"
Text='<%# Eval("PhotographerPhotoDesc") %>' />
<br />
Photo Name:
<asp:Label ID="PhotographerPhotoImgNameLabel" runat="server"
Text='<%# Eval("PhotographerPhotoImgName") %>' />
<br />
Photographer Name:
<asp:Label ID="PhotographerIdLabel" runat="server"
Text='<%# Eval("PhotographerName") %>' />
<br />
<asp:Button ID="AddCommentBtn" runat="server"
CommandArgument='<%# Eval("PhotographerPhotoId") %>' Font-Bold="True"
Font-Size="Medium" onclick="AddCommentBtn_Click" Text="Add Comment" />
<asp:Button ID="Button2" runat="server"
CommandArgument='<%# Eval("PhotographerPhotoId") %>' Font-Bold="True"
Font-Size="Medium" onclick="Button2_Click" Text="Order Photo" />
<br />
どこからテキストを取得する必要がありますか? DataListのaspxマークアップとして表示する必要があります。 –
データリストのaspxマークアップで質問を編集しました。「PhotographerPhotoIdLabel」のテキストを取得するにはどうすればよいですか? –