473,411 Members | 2,164 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Help Datagrid always displayed as disabled

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>


Nov 17 '05 #1
2 1430
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" <br********@hotmail.com> escreveu na mensagem
news:Ox**************@tk2msftngp13.phx.gbl...
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>

Nov 17 '05 #2
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" <ma***********@softway.com.br> wrote in message
news:u9**************@TK2MSFTNGP10.phx.gbl...
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

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Bill Sonia | last post by:
It seems whenever I set a DataGrid.DataSource = DataTable (vb.net) to populate a datagrid, the scroll bars on the datagrid default to disabled. And the only way I can get them to enable is to...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
10
by: Brian Conway | last post by:
I have no idea what is going on. I have a Login screen where someone types in their login information and this populates a datagrid based off of the login. Works great in debug and test through...
1
by: Maqsood Ahmed | last post by:
Hello! There is a DataGrid on a form that is populated through DataTable and filters have been applied to through DataView. The DataTable gets updated through some events and obviously it also...
2
by: Juan | last post by:
After enabling a datagrid control the scrollbar stays disabled even when i have more rows that those being displayed. It only starts working when i sort the datagrid with any displayed column... ...
1
by: Gidi | last post by:
Hi All, i have a datagrid table that contains customers names, and a textbox which the user enters the customer name and the datagrid's dataset is updated so the customer name will be first....
2
by: Lau Lei Cheong | last post by:
Hello, I'm writing a usercontrol that contains a property named "disabled". It is set to false by default but there is also another button in the usercontrol that'll set it to true. On the...
2
by: Fluxray | last post by:
--Background: I have a webform including a datagrid. The datagrid is using template. Its ItemTemplate is used to display a look-up-table with labels. its EditItemTemplate is used to edit a row in...
0
by: rn5a | last post by:
In a shopping cart app, a user purchases 5 items on 31st March 2007. This is his 1st order. He places a 2nd order on 13th April in which he buys 8 items. Next he places his 3rd order on 16th April...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.