Solved

firefox rowcommand gridview

Posted on 2010-08-13
6
1,072 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Html date format 9 20
Aspx calendar pop up control 3 28
Web content filtering solution 6 33
asp.net repeater 2 16
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
This article discusses how to implement server side field validation and display customized error messages to the client.
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)
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.

726 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