Solved

firefox rowcommand gridview

Posted on 2010-08-13
6
1,062 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jquery datepciker end date add 6 days 6 38
jqury 17 30
alert(innerHTML); 8 18
Google map my location not working in chrome 3 11
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.

777 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