Click here to Skip to main content
15,901,122 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hii

In my project I am open ribbon menu on mouseover of gridview row and also change selected row color but I won't to set selected row color constant if mouse goes to that ribbon menu content
how to do this ......
I use following code for this

C#
private void SetGridRows(GridView gvMycust)
        {
            int iRowCount = 0;
            foreach (GridViewRow gr in gvMycust.Rows)
            {
                Label lblName = (Label)gr.FindControl("custid");
                string id = lblName.Text;
                string sClass = "ListNorRow";
                if (iRowCount == 1)
                {
                    sClass = "ListAltRow";
                }

                gr.Attributes.Add("onmouseout", "javascript:this.className='" + sClass + "'");

                gr.Attributes.Add("onmouseover", "ShowPopup('" + id + "');javasscript:this.className='ListSelRow';");

                gr.Attributes.Add("OnClick", "HideContent('SubMenu');");
                iRowCount = iRowCount == 0 ? 1 : 0;
            }
        }
Posted
Updated 6-Jun-13 23:19pm
v2
Comments
SagarRS 7-Jun-13 5:23am    
What is the java script you are using
shindesb 7-Jun-13 5:54am    
hiii
I'm using following javascript......
Collapse | Copy Code
<script language="javascript" type="text/javascript">
function ShowPopup(custid
) {


var MenuContent = "Add Action";
MenuContent += "View Action";
var newDiv = document.getElementById('SubMenu');

document.getElementById('SubMenu').innerHTML = MenuContent;

ShowContent('SubMenu');
$('.nyroModal').nyroModal();
}
</script>

Hi...
Add below code in ur gridview.
XML
<asp:GridView ID="GridView1" runat="server">
     <SelectedRowStyle BackColor="Blue" />  
     //Add this in your Gridview markup
        <Columns>
          //
        </Columns>
</asp:GridView>

thank u.
 
Share this answer
 
Comments
shindesb 7-Jun-13 6:52am    
I already used this in my gridview but it not work
hiii
I'm using following javascript......
XML
<script language="javascript" type="text/javascript">
function ShowPopup(custid
) {


              var MenuContent = "<a href=\"custInfo.aspx?id=" + custid +  "\"  >Add Action</a>";
             MenuContent += "<a href=\"Viewcust.aspx?id=" + custid + "\" class=\"nyroModal\">View Action</a>";
              var newDiv = document.getElementById('SubMenu');

          document.getElementById('SubMenu').innerHTML = MenuContent;

           ShowContent('SubMenu');
            $('.nyroModal').nyroModal();
        }
</script>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900