GridView style affected by scriptmanager?
*NEW - Coolite Toolkit Version 0.8 now available for DOWNLOAD. See also Examples Explorer.
 

Coolite Forums

Welcome Guest ( Login | Register )
 
GridView style affected by scriptmanager?
Subscribe
Last Login: 6/26/2008 4:34:35 AM
Posts: 18,
Posted 3/1/2008 9:05:44 PM

Group: Coolite Early Adopter

Here's my test: (VB ASP.NET project)

Default.aspx:


<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="TestWebSite.HomePage" %>


<%@ Register Assembly="Coolite.Web.UI" Namespace="Coolite.Web.UI" TagPrefix="cool" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Hello World!</title>
</head>
<body>
    <cool:ScriptManager ID="ScriptManager1" runat="server" Hide="True" />
    <form id="form1" runat="server">
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="true" Width="300px" style="text-align: center;">
    </asp:GridView>
    </form>
</body>
</html>



Default.aspx.vb:

Imports System.Data


Partial Public Class HomePage
    Inherits System.Web.UI.Page


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim dt As New DataTable
        dt.Columns.Add("A", GetType(Integer))
        dt.Columns.Add("B", GetType(String))


        Dim dr As DataRow = dt.NewRow
        dr("A") = 1
        dr("B") = "test"


        dt.Rows.Add(dr)


        GridView1.DataSource = dt
        GridView1.DataBind()
    End Sub


End Class



If you take away the scriptmanager in the .aspx file vs if you leave it in, there's a major style difference (especially the header can't be centered no matter what I try...).

Thanks for the help in advance.

Last Login: Today @ 3:38:35 PM
Posts: 2,802,
Posted 3/1/2008 9:35:09 PM

Group: Core Development Team
Hi tongyang,

The formatting changes because by default the coolite scriptmanager control renders the ext-all.css file to the Page. You can "turn off" the stylesheet from rendering by setting the RenderStyles property in the web.config to "none".

The following forum post details how/where to add the RenderStyles property to the web.config. http://coolite.com/forums/Topic11-4-1.aspx

Hope this helps.
--
Geoffrey McGill
Coolite Inc.
Development Team
Forum Guidelines | Coolite Examples | Coolite API Docs | ExtJS API Docs | Twitter
Last Login: 6/26/2008 4:34:35 AM
Posts: 18,
Posted 3/2/2008 3:28:24 AM

Group: Coolite Early Adopter

Thanks for the reply.

Just curious.  Is it possible for me to change the embedstyles option through the code behind and not the web.config?  I don't want to set that explicitly for all pages.  If there is a session variable like the Coolite.Theme option it would be great.  Actually, it would be nice if there's a list of possible session variables

I also found out that the reason I could not override the css style is that the ext-all.css is added after my css declaration so I had to add a scriptcontainer like this:


<head runat="server">
    <title>Hello World!</title>
    <cool:ScriptContainer runat="server" />
    <style type="text/css">
        th.mygridview
        {
            text-align: center;
        }
    </style>
</head>


So, problem solved!

Last Login: Today @ 3:38:35 PM
Posts: 2,802,
Posted 3/20/2008 10:45:33 AM

Group: Core Development Team
With the version 0.4.1 release we built in four different ways to change the Theme property (as well as all the other Global Config properties).

For example, the following code demonstrates all four different ways to now change the Theme. The list is in order of precedence. The first option in the list (web.config) will be overridden if the Application variable is used. The Application variable will be overriden if the Session variable is used. The Session variable will be overridden if the Page level (ScriptManager) property is used.

Example

Option 1: web.config (See http://www.coolite.com/forums/Topic11-4-1.aspx for more information on setting web.config options)

<coolite theme="Gray" />


Option 2: Application Variable

protected void Page_Load(object sender, EventArgs e)
{
    this.Application["Coolite.Theme"] = Coolite.Web.UI.Theme.Gray;
}


Option 3: Session Variable

protected void Page_Load(object sender, EventArgs e)
{
    this.Session["Coolite.Theme"] = Coolite.Web.UI.Theme.Gray;
}


Option 4: Page level (ScriptManager)

<cool:ScriptManager ID="ScriptManager1" runat="server" Theme="Gray" />


All existing web.config properties are now supported with this four option model. Here's a list of each Global Config property.

  1. CleanResourceUrl
  2. ScriptAdapter
  3. RenderScripts
  4. RenderStyles
  5. ResourcePath
  6. ScriptMode
  7. Theme
  8. GZip *
*The GZip property is not available at the Page (ScriptManager) level. The GZip property is currently only applied to external resource (.js, .css, images). The GZip property is not aware of any Page level context and can be requested independent of a Page. Options #1, #2, and #3 listed above can be used to set the GZip property.

The Application and Session tokens for each of the Global Config properties follow a standard naming convention of "Coolite.[PROPERTY NAME]". For example to set the ScriptMode property in the Session, you would use the following code.

Example

this.Session["Coolite.ScriptMode"] = ScriptMode.Debug;


Hope this helps.
--
Geoffrey McGill
Coolite Inc.
Development Team
Forum Guidelines | Coolite Examples | Coolite API Docs | ExtJS API Docs | Twitter
« Prev Topic | Next Topic »
Reading This Topic
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.
All times are GMT -8:00, Time now is 4:18pm