back color

asp.net United States
  • 18 years ago

    Iam very new to ASP.NET. I was wondering if anyone could help me out.
    I have to change the colour of the text box on mouse over. How do i do it ? any examples ?


    Iam also using Datagrid to display the results. Is there any way to sort the datagrid when a user clicks the column header ?



    Thanks in Advance

  • 18 years ago

    I want to know that too.
    I knew javascript can do that by add "OnMouseMove" event to the textbox htmlcontrol.
    But how to do it in asp.net?
    thx

  • 18 years ago

    Well, I have got the answer to the BackColour myself


           txtDate.BackColor = System.Drawing.Color.White
           txtDate.BackColor = System.Drawing.Color.LemonChiffon




    Any answers to the Datagrid ??

  • 18 years ago

    hi jayaprad,
    does txtbox have "OnMouseOver" event?
    if not, how did you changed the bgcolor of the textbox when a mouse over?


    regards

  • 18 years ago

    Hi jayaprad,


    u can sort the columns like this:


    First set the property-AllowSorting in datagrid like this:


    <asp:DataGrid runat="server" id="id"
                 .............
                 AllowSorting="True"
                 OnSortCommand="MySortHandler"


    </asp:datagrid>


    Then for the column which u want to sort set the expression like this


    <asp:BoundColumn DataField="dbField2"
                     SortExpression="dbField2"  />


    like here it will be sorted by dbField2


    By adding the AllowSorting property to True, the DataGrid, when rendered, will have in its header for each column a hyperlink


    Sub MySortHandler(sender as Object, e as DataGridSortCommandEventArgs)
      ...
      'Add the sorting code.
    End Sub



    I hope this will solve ur problem......

  • 18 years ago


    Thanks very much Shilpa, but I was wondering If the Datagrid would do the sort by itself like other grids in VB6

  • 18 years ago

    For sorting the datagrid you need to have some event right?
    and in datagrid the event would be the header as the code which i had written.


    Otherwise u will have to sort ur results before the bind the datagrid.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Anyone who considers arithmetic methods of producing random digits is, of course, in a state of sin.” - John von Neumann