Click here to Skip to main content
15,893,381 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Click Event of dynamically created Link Button is not working Pin
Nishant Singh5-Jul-10 20:28
Nishant Singh5-Jul-10 20:28 
AnswerRe: Click Event of dynamically created Link Button is not working Pin
vishnukamath5-Jul-10 23:56
vishnukamath5-Jul-10 23:56 
GeneralRe: Click Event of dynamically created Link Button is not working Pin
Ravindra Bisen7-Jul-10 1:10
Ravindra Bisen7-Jul-10 1:10 
AnswerRe: Click Event of dynamically created Link Button is not working Pin
raju melveetilpurayil6-Jul-10 3:54
professionalraju melveetilpurayil6-Jul-10 3:54 
GeneralRe: Click Event of dynamically created Link Button is not working Pin
Ravindra Bisen7-Jul-10 1:01
Ravindra Bisen7-Jul-10 1:01 
GeneralRe: Click Event of dynamically created Link Button is not working Pin
raju melveetilpurayil7-Jul-10 8:44
professionalraju melveetilpurayil7-Jul-10 8:44 
QuestionUsing ASP_Local_Resources and Ajax Pin
FJJCENTU4-Jul-10 6:15
FJJCENTU4-Jul-10 6:15 
QuestionHow to load multiple images from SQL 2008 Database into GridView Pin
Dominick Marciano3-Jul-10 23:34
professionalDominick Marciano3-Jul-10 23:34 
I'm trying to load multiple images into a GridView from a SQL database based on a UserId. I was only able to get single images to load into a Image box.

On my page "ChangeProfile.aspx" I have:

<asp:GridView ID="GridView1" runat="server">
    </asp:GridView>


On the code-behind page (in the Page_Load event) I have:

 If Not Page.IsPostBack Then

            Dim currentUser As MembershipUser = Membership.GetUser
            Dim currentUserID As Guid
            If Request.QueryString("Id") Is Nothing Then
                currentUserID = CType(currentUser.ProviderUserKey, Guid)
            Else
                currentUserID = New Guid(Request.QueryString("Id"))
            End If
            
            Dim connectionString As String = ConfigurationManager.ConnectionStrings("SecurityTutorialsConnectionString").ConnectionString
            'Dim insertSql As String = "UPDATE UserProfiles SET MainImage=@Content WHERE UserID=@UserId"
            Dim stream As New MemoryStream

            Using myConnection As New SqlConnection
                myConnection.ConnectionString = connectionString
                
                Dim myCommand As New SqlCommand("SELECT UploadedImage FROM Images WHERE UserId=@UserId", myConnection)
                myCommand.Parameters.AddWithValue("@UserId", currentUserID)            

                Dim ds As New DataSet

                Dim Adapter As New SqlDataAdapter(myCommand)
                
                Adapter.Fill(ds)
                
                GridView1.DataSource = ds
                GridView1.DataBind()

            End Using
End Sub


The table is it trying to pull from ("Images") has the following fields:

ImageId (Guid)
UserId (Guid)
UploadedImage (Image)
ImageDescription (nvarchar(MAX))


The error occurs at the GridView1.DataBind() with the following message:

"The data source for GridView with id 'GridView1' did not have any properties or attributes from which to generate columns. Ensure that your data source has content."

When I look at the table data there are two rows for the supplied UserId (hence two images). I've been working on this for 3 hours straight and cannot figure it out. Any help would be greatly appreciated.
AnswerRe: How to load multiple images from SQL 2008 Database into GridView Pin
Not Active4-Jul-10 2:59
mentorNot Active4-Jul-10 2:59 
GeneralRe: How to load multiple images from SQL 2008 Database into GridView Pin
Dominick Marciano4-Jul-10 5:40
professionalDominick Marciano4-Jul-10 5:40 
GeneralRe: How to load multiple images from SQL 2008 Database into GridView Pin
Not Active4-Jul-10 11:30
mentorNot Active4-Jul-10 11:30 
GeneralRe: How to load multiple images from SQL 2008 Database into GridView Pin
Dominick Marciano5-Jul-10 17:45
professionalDominick Marciano5-Jul-10 17:45 
AnswerRe: How to load multiple images from SQL 2008 Database into GridView Pin
koolprasad20035-Jul-10 2:10
professionalkoolprasad20035-Jul-10 2:10 
Questioncompiler executable file csc.exe cannot be found error Pin
K.Safvi2-Jul-10 9:44
K.Safvi2-Jul-10 9:44 
AnswerRe: compiler executable file csc.exe cannot be found error Pin
Ankur\m/2-Jul-10 21:26
professionalAnkur\m/2-Jul-10 21:26 
Questionweb installer interruption [modified] Pin
Chesnokov Yuriy2-Jul-10 7:55
professionalChesnokov Yuriy2-Jul-10 7:55 
AnswerRe: web installer interruption Pin
Sandeep Mewara4-Jul-10 18:39
mveSandeep Mewara4-Jul-10 18:39 
AnswerRe: web installer interruption Pin
Dinesh Mani4-Jul-10 23:01
Dinesh Mani4-Jul-10 23:01 
QuestionDropDownList triggering an UpdatePanel Pin
Lonnie Raffray2-Jul-10 4:49
Lonnie Raffray2-Jul-10 4:49 
AnswerRe: DropDownList triggering an UpdatePanel Pin
Sandeep Mewara2-Jul-10 5:02
mveSandeep Mewara2-Jul-10 5:02 
QuestionPHP or ASP.Net for developing Web based application with SAAS Pin
nilam24772-Jul-10 1:37
nilam24772-Jul-10 1:37 
AnswerRe: PHP or ASP.Net for developing Web based application with SAAS Pin
ahmedel2-Jul-10 7:10
ahmedel2-Jul-10 7:10 
QuestionDotnetNuke Pin
kalit.sikka@gmail.com1-Jul-10 22:27
kalit.sikka@gmail.com1-Jul-10 22:27 
AnswerRe: DotnetNuke Pin
Ankur\m/2-Jul-10 2:35
professionalAnkur\m/2-Jul-10 2:35 
AnswerRe: DotnetNuke Pin
Abhijit Jana2-Jul-10 5:12
professionalAbhijit Jana2-Jul-10 5:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.