Highlighting GridView Row on MouseOver

Of late , i've  been receiving  E-Mails  asking for  publishing  the content  for BEGINNERS  in  .NET ,  So  i've decided  to  include  some  new posts  for  them .

 

In  this  article  , we'll  see  how  we  can  change  the  row color  of  a  GridView  when   anyone   moves  their mouse over  the GridView .  So  let's get it  started.

1) Create  a  page name Test.aspx

 

Test.aspx ( HTML Markup)

 <div class="TEST">
    <asp:GridView  ID="GV1" runat="server" >
        <Columns>
                  <asp:TemplateField>
                          <ItemTemplate>
  
                                 <asp:LinkButton ID="Link1"  runat="server" Text='<%# Eval("FirstName") %>' CommandName="LINK"   ></asp:LinkButton>
                         </ItemTemplate>
                  </asp:TemplateField>
       </Columns>
    </asp:GridView>
       
  </div>

 

Test.aspx.cs

protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            con = new SqlConnection("uid=sa;pwd=123456;database=Talib");
            con.Open();
            da = new SqlDataAdapter("select  * from tblRegistration order by id desc", con);
            ds = new DataSet();
            da.Fill(ds);
            GV1.DataSource = ds;  // GV1 is  the name of  GridView
            GV1.DataBind();
        }

        catch (Exception ex)
        {
            Response.Write(ex.Message);

        }
        finally
        {
            con.Close();
        }

    }

 

2)  Now  we  need to  assign  the  CSS  styling  for this   GridView  ,  illustrated  below

<style type="text/css">
        .TEST div table tr:hover
    {
          background-color:silver;
    }

</style>

 

Now, we're done.  Execute  the  page  and  see how  it  works.

 

 

I  hope you people like this post ,till  then  enjoy  Programming ......   Smile

 


Tags: , , , , ,
Categories: ASP.NET

8 Comments
Actions: E-mail | Permalink | Comment RSSRSS comment feed

Silverlight 3 Released.

Since  the time  it  was launched last year ,  Microsoft's Silverlight  has been  a  centre  of attraction  for  one  and all.  Right  from  its  look  and feel  , the  type of  applications  it can  develop,  it's  functionality   and many  more  ,  were  the  points  of  concern .  But  Silverlight  has achieved  'em  all  , thanks  to Microsoft  .  So  finally  ,  Silverlight 3   has been  released  .

The  main  features   which  constitute   Silverlight 3  are

1) HD  Media

2) Immersive Graphics

3) Out of browser support

4) Application Development


Scott Guthrie  has explained  each  and  every point  in  detail  .Please  have  a  look  at  it .



Tags: , ,
Categories: Silverlight

0 Comments
Actions: E-mail | Permalink | Comment RSSRSS comment feed

Menu.DynamicHorizontalOffset Property

In  this  article we'll  see  as  to  how  we can  use  ASP.NET  Menu's   DynamicHorizontalOffset    property  .

This  property  comes  very  handy  when  you  wanna  play  around  with the positioning  of  the  child menu   corresponding to its  parent menu  item.   Especially when  you are working  on  the  arabic  layout  of  the  page .  Actually  the  real  problem  comes when  you  create  a  DYNAMIC  menu  consisting  of  child  menu  items  as well.  So  by default ,  the positioning  of  child  menu items   comes  on  the  right  side of the menu   when  actually it  has  to  be  positioned  on  the left .  So  ,here  comes  the  DynamicHorizontalOffset   property  into  picture.

Given  below  is  an  example   as  to  how  we  can  st  this  property ,

private void PopulateMenu()
    {

              .....      //  Your  Stuff

              ......

              .....

          MyMenu.DynamicHorizontalOffset = -300;   //  MyMenu  is  the name of the  Menu

   }

 

-300  is  the  pixel  position  which  you  can  change  as per your  requirement .  The  above  syntax  has  given  especially  for  the  ARABIC  version  of   a page.


Tags: , , ,
Categories: ASP.NET

0 Comments
Actions: E-mail | Permalink | Comment RSSRSS comment feed

IE8 ,Google Chrome and Safari browsers not showing Dynamic Child Menu.

This  problem i have  faced  while developing a  page where i had to generate a dynamic  MENU ,comprising  of  data  coming  from  two  different tables that  were accumulated by  establishing  a RELATION  between  them  from  their  datasets. Now ,all it  was displaying was  a WHITE  background  for the Sub-Menus  in IE8 , Google Chrome and  Safari .

          So  , to  overcome  this  issue,  we need  to  add  a  ClientTarget property in  our  pages. But what  exactly  does  ClientTarget  property do ?  and  the  answer is "It Gets or sets a value that allows you to override automatic detection of browser capabilities and to specify how a page is rendered for particular browser clients."

  It  goes  like  this ,

 <% @ Page Language="C#" AutoEventWireup="true"  ClientTarget="uplevel" %>

 

In the Code-Behind Page, write this

Menu1.DynamicMenuStyle.CssClass = "DynamicMenuZIndex";  //  Menu1  is  the  name of  the MENU

 

StyleSheet.css

.DynamicMenuZIndex
{
    z-index: 999;
}

 

 After  adding  this , run  the application  and  see  the result..

Hope this  helps..

Please  do spare  some time  to write some  comment  regarding  this  post.

 

 


Tags: , , , , , ,
Categories: Browser

3 Comments
Actions: E-mail | Permalink | Comment RSSRSS comment feed

 


© Copyright 2009. www.onlineasp.net All Rights Reserved.