Help Datagrid always displayed as disabled

Discussion in 'ASP .Net' started by brian richards, Sep 3, 2003.

  1. The datagrid in my page always looks greyed out. But DataGrid.Enabled is set
    to true. It's never set to false. Is there any other way enabled may be set
    to false? Or maybe another reason other than the Enabled property that would
    cause this?

    I've included the asp.net code and the C# databind code.

    Thanks


    ///C# Bind code
    public void BindGrid()
    {
    string date = Request["Date"];
    if(date!=null && date!="")
    {
    try
    {
    this.sqlSelectCommand3.CommandText = "SELECT Date, UsageCharges,
    MonthlyCharges, ProratedCharges, "+
    "OneTimeCharges, TaxesFSL, OtherTaxesSurcharges, (UsageCharges +
    MonthlyCharges + ProratedCharges +"+
    "OneTimeCharges + TaxesFSL + OtherTaxesSurcharges) AS Total FROM
    tbMonthlyChargeBreakdown WHERE "+
    "Date = \'"+DateTime.Parse(date).ToString("yyyyMMdd")+"\'";
    sqlDataAdapter3.Fill(dsMonthTable1);
    dg_ChrgBreakdown.DataBind();
    }
    catch(Exception e)
    {
    Response.Write(e.Message+e.Source+e.StackTrace+"\n"+date);
    }
    }

    /////Asp.net code
    <asp:DataGrid id=dg_ChrgBreakdown runat="server" Width="100%"
    DataSource="<%# dvMonthTable %>" AutoGenerateColumns="False"
    CellPadding="1">
    <ItemStyle HorizontalAlign="Right"></ItemStyle>
    <HeaderStyle HorizontalAlign="Center" ForeColor="White"
    BackColor="#292C8B"></HeaderStyle>
    <Columns>
    <asp:BoundColumn DataField="Date" HeaderText="Date"
    DataFormatString="{0:y}">
    <ItemStyle HorizontalAlign="Left"></ItemStyle>
    </asp:BoundColumn>
    <asp:BoundColumn DataField="UsageCharges"
    HeaderText="UsageCharges"
    DataFormatString="{0:$###,###,###.00}"></asp:BoundColumn>
    <asp:BoundColumn DataField="MonthlyCharges"
    HeaderText="Monthly"
    DataFormatString="{0:$###,###,###.00}"></asp:BoundColumn>
    <asp:BoundColumn DataField="ProratedCharges"
    HeaderText="Prorated"
    DataFormatString="{0:$###,###,###.00}"></asp:BoundColumn>
    <asp:BoundColumn DataField="OneTimeCharges"
    HeaderText="One Time"
    DataFormatString="{0:$###,###,###.00}"></asp:BoundColumn>
    <asp:BoundColumn DataField="TaxesFSL"
    HeaderText="Taxes" DataFormatString="{0:$###,###,###.00}"></asp:BoundColumn>
    <asp:BoundColumn DataField="OtherTaxesSurcharges"
    HeaderText="Surcharges"
    DataFormatString="{0:$###,###,###.00}"></asp:BoundColumn>
    <asp:BoundColumn DataField="Total"
    HeaderText="Total" DataFormatString="{0:$###,###,###.00}"></asp:BoundColumn>
    </Columns>
    </asp:DataGrid>
     
    brian richards, Sep 3, 2003
    #1
    1. Advertising

  2. brian richards

    Marcos MOS Guest

    Brian,

    Have you created the DataGrid's source by Wizard or by "hand code"? I mean
    where was the dvMonthTable created?

    Because, I bind the data source a little bit different... like

    ....
    sqlDataAdapter3.Fill(dsMonthTable1);
    dg_ChrgBreakdown.DataSource = dsMonthTable1.Tables[0].DefaultView;
    dg_ChrgBreakdown.DataBind();
    ....

    I hope help you
    Marcos


    "brian richards" <> escreveu na mensagem
    news:...
    > The datagrid in my page always looks greyed out. But DataGrid.Enabled is

    set
    > to true. It's never set to false. Is there any other way enabled may be

    set
    > to false? Or maybe another reason other than the Enabled property that

    would
    > cause this?
    >
    > I've included the asp.net code and the C# databind code.
    >
    > Thanks
    >
    >
    > ///C# Bind code
    > public void BindGrid()
    > {
    > string date = Request["Date"];
    > if(date!=null && date!="")
    > {
    > try
    > {
    > this.sqlSelectCommand3.CommandText = "SELECT Date,

    UsageCharges,
    > MonthlyCharges, ProratedCharges, "+
    > "OneTimeCharges, TaxesFSL, OtherTaxesSurcharges, (UsageCharges

    +
    > MonthlyCharges + ProratedCharges +"+
    > "OneTimeCharges + TaxesFSL + OtherTaxesSurcharges) AS Total

    FROM
    > tbMonthlyChargeBreakdown WHERE "+
    > "Date = \'"+DateTime.Parse(date).ToString("yyyyMMdd")+"\'";
    > sqlDataAdapter3.Fill(dsMonthTable1);
    > dg_ChrgBreakdown.DataBind();
    > }
    > catch(Exception e)
    > {
    > Response.Write(e.Message+e.Source+e.StackTrace+"\n"+date);
    > }
    > }
    >
    > /////Asp.net code
    > <asp:DataGrid id=dg_ChrgBreakdown runat="server" Width="100%"
    > DataSource="<%# dvMonthTable %>" AutoGenerateColumns="False"
    > CellPadding="1">
    > <ItemStyle HorizontalAlign="Right"></ItemStyle>
    > <HeaderStyle HorizontalAlign="Center"

    ForeColor="White"
    > BackColor="#292C8B"></HeaderStyle>
    > <Columns>
    > <asp:BoundColumn DataField="Date"

    HeaderText="Date"
    > DataFormatString="{0:y}">
    > <ItemStyle HorizontalAlign="Left"></ItemStyle>
    > </asp:BoundColumn>
    > <asp:BoundColumn DataField="UsageCharges"
    > HeaderText="UsageCharges"
    > DataFormatString="{0:$###,###,###.00}"></asp:BoundColumn>
    > <asp:BoundColumn DataField="MonthlyCharges"
    > HeaderText="Monthly"
    > DataFormatString="{0:$###,###,###.00}"></asp:BoundColumn>
    > <asp:BoundColumn DataField="ProratedCharges"
    > HeaderText="Prorated"
    > DataFormatString="{0:$###,###,###.00}"></asp:BoundColumn>
    > <asp:BoundColumn DataField="OneTimeCharges"
    > HeaderText="One Time"
    > DataFormatString="{0:$###,###,###.00}"></asp:BoundColumn>
    > <asp:BoundColumn DataField="TaxesFSL"
    > HeaderText="Taxes"

    DataFormatString="{0:$###,###,###.00}"></asp:BoundColumn>
    > <asp:BoundColumn DataField="OtherTaxesSurcharges"
    > HeaderText="Surcharges"
    > DataFormatString="{0:$###,###,###.00}"></asp:BoundColumn>
    > <asp:BoundColumn DataField="Total"
    > HeaderText="Total"

    DataFormatString="{0:$###,###,###.00}"></asp:BoundColumn>
    > </Columns>
    > </asp:DataGrid>
    >
    >
    >
    >
     
    Marcos MOS, Sep 3, 2003
    #2
    1. Advertising

  3. The datasource was set in the ASP page.
    <asp:DataGrid id=dg_ChrgBreakdown runat="server" Width="100%"
    DataSource="<%# dvMonthTable %>" AutoGenerateColumns="False"
    CellPadding="1">
    I tried
    sqlDataAdapter3.Fill(dsMonthTable1);
    dg_ChrgBreakdown.DataSource = dsMonthTable1.Tables[0].DefaultView;
    dg_ChrgBreakdown.DataBind();
    and
    sqlDataAdapter3.Fill(dsMonthTable1);
    dg_ChrgBreakdown.DataSource = dvMonthTable;
    dg_ChrgBreakdown.DataBind();
    and
    sqlDataAdapter3.Fill(dsMonthTable1);
    dvMonthTable.Table = dsMonthTable1.Tables[0];
    dg_ChrgBreakdown.DataSource = dvMonthTable;
    dg_ChrgBreakdown.DataBind();

    But I get the same gray results.

    -Brian


    "Marcos MOS" <> wrote in message
    news:...
    > Brian,
    >
    > Have you created the DataGrid's source by Wizard or by "hand code"? I mean
    > where was the dvMonthTable created?
    >
    > Because, I bind the data source a little bit different... like
    >
    > ...
    > sqlDataAdapter3.Fill(dsMonthTable1);
    > dg_ChrgBreakdown.DataSource = dsMonthTable1.Tables[0].DefaultView;
    > dg_ChrgBreakdown.DataBind();
    > ...
    >
    > I hope help you
    > Marcos
    >
    >
     
    brian richards, Sep 3, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dot net work
    Replies:
    0
    Views:
    451
    Dot net work
    Jun 27, 2004
  2. boney
    Replies:
    1
    Views:
    584
  3. Oleg Ogurok

    Custom paging problems - first page always displayed

    Oleg Ogurok, Jul 8, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    128
    Oleg Ogurok
    Jul 8, 2003
  4. CFirmino
    Replies:
    1
    Views:
    150
    Alvin Bruney [MVP]
    Apr 4, 2004
  5. Dot net work

    Ensure selected treeview node is always displayed?

    Dot net work, Jun 15, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    164
    Dot net work
    Jun 15, 2004
Loading...

Share This Page