GridView Issues
GridView Issues
GridView Issues
GridView Issues
GridView Issues
GridView Issues GridView Issues GridView Issues GridView Issues GridView Issues GridView Issues GridView Issues GridView Issues
GridView Issues GridView Issues
GridView Issues
Go Back  Xtreme Visual Basic Talk > > > GridView Issues


Reply
 
Thread Tools Display Modes
  #1  
Old 01-18-2011, 01:54 PM
jaden2001 jaden2001 is offline
Junior Contributor
 
Join Date: Apr 2005
Location: Albany, GA
Posts: 235
Default GridView Issues


Hello,

I am working on a simple message system using an access database. I have the auto select command set to true for viewing messages and I also created a linkbutton to reply to a message. This is what I have so far:

Code:
 Protected Sub GridView2_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView2.RowCommand
        If e.CommandName = "Reply" Then
            gridMessageReply()
        End If
    End Sub
    Private Sub gridMessageReply(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSelectEventArgs) Handles GridView2.SelectedIndexChanging
        Dim row As GridViewRow = GridView2.Rows(e.NewSelectedIndex)
        txt_subject.Text = "RE: " + row.Cells(5).Text
    End Sub
    Protected Sub GridView2_SelectedIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSelectEventArgs) Handles GridView2.SelectedIndexChanging
        Dim row2 As GridViewRow = GridView2.Rows(e.NewSelectedIndex)
        view_message.Text = row2.Cells(6).Text
        view_subject.Text = row2.Cells(5).Text
        view_time.Text = row2.Cells(3).Text
        view_user.Text = row2.Cells(4).Text
    End Sub
The code errors where I call the sub gridMessageReply, but it works fine when all the code is placed in the GridView2_SelectedIndexChanging sub. Any suggestions or tips to help me overcome this issue?

Thanks,
Cody Wright
__________________
Da Vinci - "Sleep is but a waste of time"
Reply With Quote
  #2  
Old 01-18-2011, 02:43 PM
PlausiblyDamp's Avatar
PlausiblyDampGridView Issues PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

The gridMessageReplyfunction looks like
Code:
Private Sub gridMessageReply(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSelectEventArgs) Handles GridView2.SelectedIndexChanging
which defines it as taking two parameters (Object and GridViewSelectEventArgs) yet when you call it
Code:
gridMessageReply()
you aren't providing these parameters.

The gridMessageReply has the same signature as the SelectedIndexChanging event so I am not entirely sure how you will provide the GridViewSelectEventArgs parameter to it.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #3  
Old 01-18-2011, 03:10 PM
jaden2001 jaden2001 is offline
Junior Contributor
 
Join Date: Apr 2005
Location: Albany, GA
Posts: 235
Default

I understand the parameter issue. I am just curious in how I can work around this, because this is the only other idea that I could come up with to allow for the reply to the message. Any other suggestions?

Thanks,
Cody Wright
__________________
Da Vinci - "Sleep is but a waste of time"
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
GridView Issues
GridView Issues
GridView Issues GridView Issues
GridView Issues
GridView Issues
GridView Issues GridView Issues GridView Issues GridView Issues GridView Issues GridView Issues GridView Issues
GridView Issues
GridView Issues
 
GridView Issues
GridView Issues
 
-->