I have <asp:SqlDataSource> in aspx page that is being used by an updateable GridView. However, there are a couple fields in the dataset that contain filenames that I want to access directly in code and place them into some image tags on the page.
This line should give me access to the dataset but how to I access the fields?
Dim myDataSourceAs DataView =DirectCast(SqlDataSourceGridView.[Select](DataSourceSelectArguments.Empty), DataView)
When the SqlDataSource is a DataReader I would access it with the code below but since this SqlDataSource is a DataSet I can't access it with this code.
If myDataSource.ReadThen
If Convert.IsDBNull(myDataSource("CusAgentPhoto"))Then
ImageAgent.ImageUrl ="/photos/nophoto.gif"
Else
ImageAgent.ImageUrl = AgentImagePath & myDataSource("CusAgentPhoto").ToString
EndIf
IfConvert.IsDBNull(myDataSource("CusCompanyLogo"))Then
ImageCompany.ImageUrl="/photos/nophoto.gif"
Else
ImageCompany.ImageUrl=OfficeImagePath & myDataSource("CusCompanyLogo").ToString
EndIf
End If
What would be the correct way to get at the DataSet fields that contain the filenames?
Programmatically accessing values from datasource controls:http://www.mikesdotnetting.com/Article.aspx?ArticleID=45
Also, How to conditionally show an image:http://www.mikesdotnetting.com/Article.aspx?ArticleID=18
|||That was the info I needed. Excellent reference!
No comments:
Post a Comment