Solved

firefox rowcommand gridview

Posted on 2010-08-13
6
1,060 Views
Last Modified: 2013-12-07
ASP = 2.0

ie 8+  Everything works great.

In Firefox my rowcommand is not firing

Here is the code behind

    Protected Sub MYGRIDVIEW_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles QueryNameList.RowCommand
        Dim rowIndex As Integer = Integer.Parse(e.CommandArgument.ToString())
        Me.MYGRIDVIEW.SelectedIndex = rowIndex
 response.write(e.commandname)
         
    End Sub

    Protected Sub MYGRIDVIEW_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles QueryNameList.RowDataBound
              e.Row.Attributes.Add("onclick", _
       Page.ClientScript.GetPostBackEventReference(sender, "Select$" + e.Row.RowIndex.ToString))
 
   End Sub

THE  MYGRIDVIEW_RowDataBoundIS WHERE IT BREAKS. THE JAVA INSERTION "   Page.ClientScript..." seems to trump the row command. If I take out this code the EDIT button works but I need this in order to select a row and have it appear selected -  Yellow(see below)



Here's the aspx - remember it works correctly in IE 8
Notice there is a hidden select field -Not sure if it is needed, Choosing rows works in firefox. The select command is what is sent regardless if I press the edit button or not.(see response.write(e.commandname) above.

  <asp:GridView ID="MYGRIDVIEW" runat="server" onmouseout = "document.body.style.cursor = 'pointer'"  AutoGenerateColumns="False"     DataSourceID="MYDATA" ">
              <Columns>
                         <asp:BoundField DataField="MYFIELDNAME"   >
                  </asp:BoundField>
                      <asp:ButtonField CommandName="EDIT" Text="EDIT">
                        </asp:ButtonField>
            <asp:CommandField ShowSelectButton="True" >
                       <HeaderStyle CssClass="HiddenColumn" />
                       <ItemStyle CssClass="HiddenColumn" />
                   </asp:CommandField>
              </Columns>
<SelectedRowStyle BackColor="Yellow" />
                                               
                       </asp:GridView>


WOULD THIS BE RESOLVED BY GOING TO asp 3.x???
0
Comment
Question by:janmishkin
  • 4
  • 2
6 Comments
 
LVL 41

Expert Comment

by:guru_sami
ID: 33432409
Actually I once used and it worked well.

Page.ClientScript.GetPostBackClientHyperlink(this.GridView1, "Select$" + e.Row.RowIndex)

http://www.codeproject.com/KB/webforms/JavaRowSelect.aspx
0
 

Author Comment

by:janmishkin
ID: 33456356
I have all of that in my code. There is something not working with FireFox. The problem is just with Firefox.
0
 
LVL 41

Expert Comment

by:guru_sami
ID: 33456391
just to be sure... you noticed the difference between the two codes:
you have GetPostBackEventReference and I have GetPostBackClientHyperlink ...not sure how much it matters because I have it working in IE and FF.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:janmishkin
ID: 33458122
heres the problem
 e.Row.Attributes("onclick") =
trumps all my gridview commands in firefox so the only command read is a "Select"
0
 

Author Comment

by:janmishkin
ID: 33458140
I changed to GetPostBackClientHyperlink  and its the same problem. It reads all onclick events as a "Select" even if I am clicking a command button.
0
 

Accepted Solution

by:
janmishkin earned 0 total points
ID: 33505305
I got rid of the java when the browser is firefox. It works well enough now.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now