GridView style affected by scriptmanager?

  1. #1

    GridView style affected by scriptmanager?



    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.
  2. #2

    RE: GridView style affected by scriptmanager?

    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://forums.ext.net/showthread.php...id=11-4-1.aspx

    Hope this helps.
    Geoffrey McGill
    Founder
  3. #3

    RE: GridView style affected by scriptmanager?



    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!
  4. #4

    RE: GridView style affected by scriptmanager?

    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://forums.ext.net/showthread.php?threadid=11-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
    Founder
  5. #5

    RE: GridView style affected by scriptmanager?

    This issue is driving me crazy - I have a standard ASP gridview on my page - works and looks great - drop a scriptmanager in and my column alignment, padding, etc. is lost - I want to use te ScriptManager yet do not want to lose all of my asp:gridview style settings... Any help would save my week - have been at this for over 2 days now and about to give up as I cannot convert my asp gridviews to coolite - I need to keep them as is for now...
  6. #6

    RE: GridView style affected by scriptmanager?

    here is my full client code:
    
    
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="ProFee3.aspx.cs" Inherits="Calculator_V2_Reports_ProFee"
    
    
    Theme="CalcTheme" %>
    
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    
    <!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>Untitled Page</title>
    
    
    <ext:ScriptContainer ID="ScriptContainer1" runat="server" />
    
    
    <ext:StyleContainer ID="StyleContainer1" runat="server" />
    
    
    <script type="text/javascript">
    
    
    
    
    
    function CopyGridViewPRO()
    
    
    {
    
    
    var div = &#100;ocument.getElementById('divGridViewPRO');
    
    
    div.contentEditable = 'true';
    
    
    var controlRange;
    
    
    if (&#100;ocument.body.createControlRange) {
    
    
    controlRange = &#100;ocument.body.createControlRange();
    
    
    controlRange.addElement(div);
    
    
    controlRange.execCommand('Copy');
    
    
    }
    
    
    div.contentEditable = 'false';
    
    
    
    
    
    alert('The results have been copied to your clipboard');
    
    
    }
    
    
    
    
    
    </script>
    
    
    </head>
    
    
    <body>
    
    
    <form id="form1" runat="server">
    
    
    <ext:ScriptManager ID="ScriptManager1" EnableTheming="true" runat="server">
    
    
    </ext:ScriptManager>
    
    
    
    
    
    <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
    
    
    <tr>
    
    
    <td align="left">
    
    
    <asp:Label ID="lblTitle" runat="server" Text="Label"></asp:Label></td>
    
    
    </tr>
    
    
    <tr>
    
    
    <td style="height: 6px">
    
    
    </td>
    
    
    </tr>
    
    
    <tr>
    
    
    <td align="left">
    
    
    <asp:Label ID="lblDesc" runat="server" Text="Label"></asp:Label><asp:Panel Visible="false"
    
    
    runat="server" ID="export" Style="float: right;">
    
    
    <ext:HyperLink runat="server" ID="hrefPDF" IconCls="icon-pdf" Text="Export to PDF"
    
    
    Target="_blank" />
    
    
    &amp;nbsp; |
    
    
    <ext:HyperLink runat="server" ID="hrefXLS" IconCls="icon-xls" Text="Export to Excel"
    
    
    Target="_blank" />
    
    
    &amp;nbsp; |&amp;nbsp;<ext:LinkButton runat="server" ID="lb1" IconCls="icon-clipboard" Text="Copy to Clipboad">
    
    
    <Listeners>
    
    
    <Click Fn="CopyGridViewPRO" />
    
    
    </Listeners>
    
    
    </ext:LinkButton>
    
    
    &amp;nbsp;|&amp;nbsp;<ext:LinkButton runat="server" ID="lbSubscribe" IconCls="icon-emailadd"
    
    
    Text="Subscribe">
    
    
    <Listeners>
    
    
    <Click Handler="alert('You have successfully subscribed to Physicians Fee Schedule data updates.\r\n\r\nYou will be notified via email when this data changes or is otherwise updated.');" />
    
    
    </Listeners>
    
    
    <AjaxEvents>
    
    
    <Click OnEvent="subscribe">
    
    
    <ExtraParams>
    
    
    <ext:Parameter Name="action" Value="1" Mode="Raw" />
    
    
    </ExtraParams>
    
    
    </Click>
    
    
    </AjaxEvents>
    
    
    </ext:LinkButton>
    
    
    <ext:LinkButton runat="server" ID="lbUnsubscribe" IconCls="icon-removed" Text="Unsubscribe">
    
    
    <Listeners>
    
    
    <Click Handler="alert('You have successfully unsubscribed to\r\nPhysicians Fee Schedule data updates.');" />
    
    
    </Listeners>
    
    
    <AjaxEvents>
    
    
    <Click OnEvent="subscribe">
    
    
    <ExtraParams>
    
    
    <ext:Parameter Name="action" Value="0" Mode="Raw" />
    
    
    </ExtraParams>
    
    
    </Click>
    
    
    </AjaxEvents>
    
    
    </ext:LinkButton>
    
    
    </asp:Panel>
    
    
    </td>
    
    
    </tr>
    
    
    <tr>
    
    
    <td style="height: 6px">
    
    
    </td>
    
    
    </tr>
    
    
    <tr>
    
    
    <td align="left">
    
    
    <div id="divGridViewPRO">
    
    
    <asp:GridView ID="GridView1" runat="server" Width="100%" AutoGenerateColumns="False"
    
    
    OnDataBound="format">
    
    
    <Columns>
    
    
    <asp:BoundField DataField="hcpsLabel" HtmlEncode="False" HeaderText="HCPCS/CPT&amp;#174;"
    
    
    SortExpression="long_desc">
    
    
    <%-- <ItemStyle Width="80px" />--%>
    
    
    </asp:BoundField>
    
    
    <asp:BoundField DataField="GLOB" HeaderText="Global Days" SortExpression="GLOB">
    
    
    <HeaderStyle HorizontalAlign="Center" />
    
    
    <ItemStyle HorizontalAlign="Center" />
    
    
    </asp:BoundField>
    
    
    <asp:BoundField DataField="pctc" HeaderText="PC/TC Indicator" SortExpression="pctc">
    
    
    <HeaderStyle HorizontalAlign="Center" />
    
    
    <ItemStyle HorizontalAlign="Center" />
    
    
    </asp:BoundField>
    
    
    <asp:BoundField DataField="si" HeaderText="Status Code" SortExpression="si">
    
    
    <HeaderStyle HorizontalAlign="Center" />
    
    
    <ItemStyle HorizontalAlign="Center" />
    
    
    </asp:BoundField>
    
    
    <asp:BoundField DataField="1facRVU" HeaderText="Fac RVU" SortExpression="1facRVU">
    
    
    <HeaderStyle HorizontalAlign="Right" />
    
    
    <ItemStyle HorizontalAlign="Right" />
    
    
    </asp:BoundField>
    
    
    <asp:BoundField DataField="1nonFacRVU" HeaderText="Non Fac RVU" SortExpression="1nonFacRVU">
    
    
    <HeaderStyle HorizontalAlign="Right" />
    
    
    <ItemStyle HorizontalAlign="Right" />
    
    
    </asp:BoundField>
    
    
    <asp:BoundField DataField="1mpRVU" HeaderText="MP RVU" SortExpression="1mpRVU">
    
    
    <HeaderStyle HorizontalAlign="Right" />
    
    
    <ItemStyle HorizontalAlign="Right" />
    
    
    </asp:BoundField>
    
    
    <asp:BoundField DataField="1fac" HeaderText="Fac" SortExpression="1fac" DataFormatString="{0:c}">
    
    
    <HeaderStyle HorizontalAlign="Right" />
    
    
    <ItemStyle HorizontalAlign="Right" />
    
    
    </asp:BoundField>
    
    
    <asp:BoundField DataField="1nonFac" HeaderText="Non Fac" SortExpression="1nonFac"
    
    
    DataFormatString="{0:c}">
    
    
    <HeaderStyle HorizontalAlign="Right" />
    
    
    <ItemStyle HorizontalAlign="Right" />
    
    
    </asp:BoundField>
    
    
    <asp:BoundField DataField="2facRVU" HeaderText="Fac RVU" SortExpression="2facRVU">
    
    
    <HeaderStyle HorizontalAlign="Right" />
    
    
    <ItemStyle HorizontalAlign="Right" />
    
    
    </asp:BoundField>
    
    
    <asp:BoundField DataField="2nonFacRVU" HeaderText="Non Fac RVU" SortExpression="2nonFacRVU">
    
    
    <HeaderStyle HorizontalAlign="Right" />
    
    
    <ItemStyle HorizontalAlign="Right" />
    
    
    </asp:BoundField>
    
    
    <asp:BoundField DataField="2mpRVU" HeaderText="MP RVU" SortExpression="2mpRVU">
    
    
    <HeaderStyle HorizontalAlign="Right" />
    
    
    <ItemStyle HorizontalAlign="Right" />
    
    
    </asp:BoundField>
    
    
    <asp:BoundField DataField="2fac" HeaderText="Fac" SortExpression="2fac" DataFormatString="{0:c}">
    
    
    <HeaderStyle HorizontalAlign="Right" />
    
    
    <ItemStyle HorizontalAlign="Right" />
    
    
    </asp:BoundField>
    
    
    <asp:BoundField DataField="2nonFac" HeaderText="Non Fac" SortExpression="2nonFac"
    
    
    DataFormatString="{0:c}">
    
    
    <HeaderStyle HorizontalAlign="Right" />
    
    
    <ItemStyle HorizontalAlign="Right" />
    
    
    </asp:BoundField>
    
    
    <asp:BoundField DataField="3facRVU" HeaderText="Fac RVU" SortExpression="3facRVU">
    
    
    <HeaderStyle HorizontalAlign="Right" />
    
    
    <ItemStyle HorizontalAlign="Right" />
    
    
    </asp:BoundField>
    
    
    <asp:BoundField DataField="3nonFacRVU" HeaderText="Non Fac RVU" SortExpression="3nonFacRVU">
    
    
    <HeaderStyle HorizontalAlign="Right" />
    
    
    <ItemStyle HorizontalAlign="Right" />
    
    
    </asp:BoundField>
    
    
    <asp:BoundField DataField="3mpRVU" HeaderText="MP RVU" SortExpression="3mpRVU">
    
    
    <HeaderStyle HorizontalAlign="Right" />
    
    
    <ItemStyle HorizontalAlign="Right" />
    
    
    </asp:BoundField>
    
    
    <asp:BoundField DataField="3fac" HeaderText="Fac" SortExpression="3fac" DataFormatString="{0:c}">
    
    
    <HeaderStyle HorizontalAlign="Right" />
    
    
    <ItemStyle HorizontalAlign="Right" />
    
    
    </asp:BoundField>
    
    
    <asp:BoundField DataField="3nonFac" HeaderText="Non Fac" SortExpression="3nonFac"
    
    
    DataFormatString="{0:c}">
    
    
    <HeaderStyle HorizontalAlign="Right" />
    
    
    <ItemStyle HorizontalAlign="Right" />
    
    
    </asp:BoundField>
    
    
    </Columns>
    
    
    <RowStyle VerticalAlign="Top" />
    
    
    <HeaderStyle BackColor="#253352" Font-Bold="true" ForeColor="White" />
    
    
    </asp:GridView>
    
    
    
    
    
    
    </td>
    
    
    </tr>
    
    
    </table>
    
    
    
    
    
    
    </form>
    
    
    </body>
    
    
    </html>

Similar Threads

  1. Replies: 2
    Last Post: Nov 04, 2011, 6:06 PM
  2. Gridview column style
    By sedgar in forum 1.x Help
    Replies: 1
    Last Post: Aug 04, 2011, 2:16 PM
  3. ScriptManager with asp:Gridview - fomatting gone?
    By Tbaseflug in forum 1.x Help
    Replies: 1
    Last Post: Dec 16, 2009, 10:38 PM
  4. [CLOSED] GridView style problem
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 26, 2009, 7:06 AM
  5. ext:ScriptManager use???
    By pearl in forum 1.x Help
    Replies: 2
    Last Post: Mar 03, 2009, 8:03 AM

Posting Permissions