formatting selected item in datagrid

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • TB

    #1

    formatting selected item in datagrid

    Hi All:

    I hope that this is the right group for posting the following (newbie)
    question:

    Using VS.NET 2003 I have created a datagrid, where I want to ensure
    that all text both when viewed AND when edited is displayed in Verdana
    9px

    This code goes like this:

    <asp:DataGrid id="MyDataGrid " runat="server"
    autogeneratecol umns="False" AlternatingItem Style-BackColor="#C0C 0C0"
    AllowPaging="Tr ue" OnPageIndexChan ged="PageChange "
    OnEditCommand=" EditDataGrid_Ed it" OnCancelCommand ="EditDataGrid_ Cancel"
    OnUpdateCommand ="EditDataGrid_ Update" PageSize="10"
    Font-Name="Verdana" Font-Size="9px" HeaderStyle-BackColor="#88B 5DA"
    Width="100%">
    <EditItemStyl e Font-Name="Verdana"/>
    <EditItemStyl e Font-Size="9px"/>
    <Columns>

    (etc, etc)

    Whereas all the viewable data is displayed in Verdana 9px, whenever I
    try to edit something the letters inside the textboxes of the selected
    item is displayed as something that looks like Arial 10px.

    Any suggestions will be highly appreciated.

    Thanks

    TB

  • Phillip Williams

    #2
    RE: formatting selected item in datagrid

    The textbox would not inherit the style for the EditItem (the latter is a
    tablerow and the former is an input tag within the tablerow).

    Try instead specifying a cssClass in the EditItemStyle. For example:
    cssClass="MyEdi tItem", then in the Style section add

    ..MyEditItem TD{font-family:verdana; font-size:9px;}
    --
    HTH,
    Phillip Williams




    "TB" wrote:
    [color=blue]
    > Hi All:
    >
    > I hope that this is the right group for posting the following (newbie)
    > question:
    >
    > Using VS.NET 2003 I have created a datagrid, where I want to ensure
    > that all text both when viewed AND when edited is displayed in Verdana
    > 9px
    >
    > This code goes like this:
    >
    > <asp:DataGrid id="MyDataGrid " runat="server"
    > autogeneratecol umns="False" AlternatingItem Style-BackColor="#C0C 0C0"
    > AllowPaging="Tr ue" OnPageIndexChan ged="PageChange "
    > OnEditCommand=" EditDataGrid_Ed it" OnCancelCommand ="EditDataGrid_ Cancel"
    > OnUpdateCommand ="EditDataGrid_ Update" PageSize="10"
    > Font-Name="Verdana" Font-Size="9px" HeaderStyle-BackColor="#88B 5DA"
    > Width="100%">
    > <EditItemStyl e Font-Name="Verdana"/>
    > <EditItemStyl e Font-Size="9px"/>
    > <Columns>
    >
    > (etc, etc)
    >
    > Whereas all the viewable data is displayed in Verdana 9px, whenever I
    > try to edit something the letters inside the textboxes of the selected
    > item is displayed as something that looks like Arial 10px.
    >
    > Any suggestions will be highly appreciated.
    >
    > Thanks
    >
    > TB
    >
    >[/color]

    Comment

    • Phillip Williams

      #3
      RE: formatting selected item in datagrid

      Make that

      ..MyEditItem td input{font-family:verdana; font-size:9px;}

      "Phillip Williams" wrote:
      [color=blue]
      > The textbox would not inherit the style for the EditItem (the latter is a
      > tablerow and the former is an input tag within the tablerow).
      >
      > Try instead specifying a cssClass in the EditItemStyle. For example:
      > cssClass="MyEdi tItem", then in the Style section add
      >
      > .MyEditItem TD{font-family:verdana; font-size:9px;}
      > --
      > HTH,
      > Phillip Williams
      > http://www.societopia.net
      > http://www.webswapp.com
      >
      >
      > "TB" wrote:
      >[color=green]
      > > Hi All:
      > >
      > > I hope that this is the right group for posting the following (newbie)
      > > question:
      > >
      > > Using VS.NET 2003 I have created a datagrid, where I want to ensure
      > > that all text both when viewed AND when edited is displayed in Verdana
      > > 9px
      > >
      > > This code goes like this:
      > >
      > > <asp:DataGrid id="MyDataGrid " runat="server"
      > > autogeneratecol umns="False" AlternatingItem Style-BackColor="#C0C 0C0"
      > > AllowPaging="Tr ue" OnPageIndexChan ged="PageChange "
      > > OnEditCommand=" EditDataGrid_Ed it" OnCancelCommand ="EditDataGrid_ Cancel"
      > > OnUpdateCommand ="EditDataGrid_ Update" PageSize="10"
      > > Font-Name="Verdana" Font-Size="9px" HeaderStyle-BackColor="#88B 5DA"
      > > Width="100%">
      > > <EditItemStyl e Font-Name="Verdana"/>
      > > <EditItemStyl e Font-Size="9px"/>
      > > <Columns>
      > >
      > > (etc, etc)
      > >
      > > Whereas all the viewable data is displayed in Verdana 9px, whenever I
      > > try to edit something the letters inside the textboxes of the selected
      > > item is displayed as something that looks like Arial 10px.
      > >
      > > Any suggestions will be highly appreciated.
      > >
      > > Thanks
      > >
      > > TB
      > >
      > >[/color][/color]

      Comment

      • TB

        #4
        Re: formatting selected item in datagrid

        It worked. Thanks a lot.

        A follow-up question: How can ensure that the column widths always
        remain the same regardless of whether I am a view mode or in edit mode?

        TB

        Comment

        • Phillip Williams

          #5
          Re: formatting selected item in datagrid

          You might want to follow up on questions of styling on:
          comp.infosystem s.www.authoring.stylesheets

          However, you can define the styles of a column within the TemplateColumns
          themselves, e.g.:
          <asp:TemplateCo lumn >
          <ItemStyle CssClass ="Column1ItemSt yle"></ItemStyle>
          <HeaderStyle cssClass="Colum n1HeaderStyle"> </HeaderStyle>
          <FooterStyle CssClass ="Column1Footer Style"></FooterStyle>
          <ItemTemplate >
          <!-- place here your controls and HTML -->
          </ItemTemplate>
          <EditItemTempla te >
          <!-- place here your controls and HTML -->
          </EditItemTemplat e>
          <FooterTempla te >
          <!-- place here your controls and HTML -->
          </FooterTemplate>
          </asp:TemplateCol umn>

          --
          HTH,
          Phillip Williams




          "TB" wrote:
          [color=blue]
          > It worked. Thanks a lot.
          >
          > A follow-up question: How can ensure that the column widths always
          > remain the same regardless of whether I am a view mode or in edit mode?
          >
          > TB
          >
          >[/color]

          Comment

          • TB

            #6
            Re: formatting selected item in datagrid

            Yeah, I admit it: that was a very newbie-like question. Thanks for
            replying anyway.

            TB

            Comment

            Working...