Thursday, May 03, 2007

Nuance - ASP.NET

Nuance - ASP.NET VB.NET 2005 .NET 2.0 GridView Button

Some things are so simple that most people do not think to document them.

For example:
“How do you set a GridView caption a different color then the rest of the grid?”
The simplest way is to set the GridView ForeColor equal to the color you want the caption then set the HeaderStyle and RowStyle ForeColor equal to the default color
So if you wanted a red caption and black text in the column name and rows …

    <asp:gridview id="GridView1" runat="server"
        ...
        caption="Your Caption" forecolor="red">
        <HeaderStyle ForeColor="black" />
        <RowStyle ForeColor="black" />
        <Columns>
        ...

“Close Browser Window From Button Web Control”
Okay, I did find some writing on this.
http://www.getfreesofts.com

Name: Close Browser Window From Button Web Control
Author: Bipin Joshi
Category: ASP.NET / Browsers
HomePage: http://www.dotnetbips.com/articles/fca4c3e0-0008-445d-817d-c8e273348c37.aspx
No. of hits: 5603

HOW TO: Close Browser Window From Button Web Control is a web based tutorial in which author explains the method of closing the browser window with the server side controls, using a button click event control. The author explains the above said procedure with the help of examples and source code. The author concludes this tutorial by suggesting users to use server control instead of client scripts.


Code that closes the window
In the click event handler of button1 write following code:

Private Sub Button1_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    ' perform other server side tasks here
    Response.Write("<script>window.close();</script>")
End Sub

No comments: