Question about ASP.NET gridviews - asp.net

I have a gridview. Is it possible to modify the gridview so that I can have multiple rows in the column headers? For example, the following code generates the table in the picture below.
<asp:GridView ID="productsGridView" Runat="server" DataSourceID="productDataSource" AutoGenerateColumns="False" AllowSorting="True" BorderWidth="2px"
BackColor="White" GridLines="None" CellPadding="3" CellSpacing="1" BorderStyle="Ridge" BorderColor="White" AllowPaging="True">
<FooterStyle ForeColor="Black" BackColor="#C6C3C6"></FooterStyle>
<PagerStyle ForeColor="Black" HorizontalAlign="Right" BackColor="#C6C3C6"></PagerStyle>
<HeaderStyle ForeColor="#E7E7FF" Font-Bold="True" BackColor="#4A3C8C"></HeaderStyle>
<Columns>
<asp:BoundField HeaderText="Product" DataField="ProductName" SortExpression="ProductName"></asp:BoundField>
<asp:BoundField HeaderText="Unit Price" DataField="UnitPrice" SortExpression="UnitPrice" DataFormatString="{0:c}">
<ItemStyle HorizontalAlign="Right"></ItemStyle>
</asp:BoundField>
<asp:BoundField HeaderText="Units In Stock" DataField="UnitsInStock" SortExpression="UnitsInStock" DataFormatString="{0:d}">
<ItemStyle HorizontalAlign="Right"></ItemStyle>
</asp:BoundField>
<asp:BoundField HeaderText="Quantity Per Unit" DataField="QuantityPerUnit"></asp:BoundField>
</Columns>
<SelectedRowStyle ForeColor="White" Font-Bold="True" BackColor="#9471DE"></SelectedRowStyle>
<RowStyle ForeColor="Black" BackColor="#DEDFDE"></RowStyle>
</asp:GridView>
This table only has one row in the column header. What I am looking for is something like this:
Any Ideas on how I can achieve this? Is this even possible?

If you use a TemplateField instead, you can control the header template as well, which can be custom ASPX markup. The downside is that you have to display the data manually with Labels instead of using the simpler BoundField properties. However, this also allows you to layout the data in a custom layout to fit with the heading:
<Columns>
<asp:TemplateField>
<HeaderTemplate>
Weight<br />
Date | Time<br />
Product
</HeaderTemplate>
<ItemTemplate>
<asp:Label runat="server" Text='<%#Eval("Weight") %>'></asp:Label><br />
<asp:Label runat="server" Text='<%#Eval("Date") %>'></asp:Label> |
<asp:Label runat="server" Text='<%#Eval("Time") %>'></asp:Label><br />
<asp:Label runat="server" Text='<%#Eval("Product") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>

Related

Why do the gridview still appears even if the datasource is empty?

<asp:GridView ID="gv_Info" runat="server" Width="1240px" BorderWidth="1px"
CellPadding="4" BorderColor="Gray" AlternatingItemStyle-BackColor="#f6f6eb"
BackColor="#F3372A" AutoGenerateColumns="False" ShowFooter="false">
<AlternatingRowStyle BackColor="White" Wrap="false" />
<Columns>
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<asp:CheckBox ID="chkSelectAsset" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="d" HeaderText="ATag">
<HeaderStyle HorizontalAlign="Center" />
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="c" HeaderText="Description">
<HeaderStyle />
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="a" HeaderText="AType">
<HeaderStyle />
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="q" HeaderText="ID">
<HeaderStyle />
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
</Columns>
</asp:GridView>
gv_InfoAssetsByParams.DataSource = ArrayAssets.ToList()
gv_InfoAssetsByParams.DataBind()
but when ArrayAssets is empty I want to make the gridview empty. SO I do this,
If ArrayAssets.Length > 0 Then
gv_Info.DataSource = ArrayAssets.ToList()
gv_Info.DataBind()
Else
gv_Info.DataSource = ArrayAssets.ToList()
gv_Info.DataBind()
End If
But it still appears even if i assign Nothing to the data source. How do I make it empty with headers?
ASP has a property called ShowHeader when empty. (http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.showheaderwhenempty.aspx)
Set ShowHeaderWhenEmpty="false", that should work.
After looking at your code, you are repeating the same thing in your IF statement.
I tried to replicate your problem on my end, and indeed if the datasource is empty the grid is not visible. I think you should look at the properties of your gridview and go from there. As well, I recommend using a repeater for more control of the visibility and layout when displaying data.

Gridview Paging is always on

I want to turn paging off on a gridview, however, I can't seem to turn it off and I don't understand hwy it is on to begin with.
This seems like such a basic issue, but I can't seem to find anyone having the same issue. I can find plenty of people having issues in turning paging on, but no one turning it off.
ASP.Net Code
<asp:TabContainer ID="tcQuestions" runat="server" Width="100%" ActiveTabIndex="2">
<asp:TabPanel ID="tpAll" runat="server" HeaderText="All Questions" ScrollBars="None">
<ContentTemplate>
<asp:UpdatePanel ID="upAll" runat="server">
<ContentTemplate>
<asp:GridView ID="gvAllQuestions" runat="server" DataSourceID="sdsQuestions" AutoGenerateColumns="False" AllowPaging="False" Width="100%">
<Columns>
<asp:HyperLinkField DataTextField="QuestionRef" HeaderText="Ref" DataNavigateUrlFields="FkSection,QuestionID" DataNavigateUrlFormatString="questions/{0}/{1}">
<HeaderStyle Wrap="False" />
<ItemStyle Wrap="False" />
</asp:HyperLinkField>
<asp:BoundField DataField="QuestionText" HeaderText="Question" />
<asp:BoundField DataField="Period" HeaderText="Frequency">
<HeaderStyle Wrap="False" />
<ItemStyle Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="ValidFrom" HeaderText="Start From" DataFormatString="{0:dd MMM yy}">
<HeaderStyle Wrap="False" />
<ItemStyle Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="ObsoleteDate" HeaderText="Next Review" DataFormatString="{0:dd MMM yy}">
<HeaderStyle Wrap="False" />
<ItemStyle Wrap="False" />
</asp:BoundField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="sdsQuestions" runat="server"
ConnectionString="<%$ ConnectionStrings:ApplicationConnectionString %>"
SelectCommand="SELECT QuestionID, QuestionRef, QuestionText, FkSection, Period, ValidFrom, ObsoleteDate FROM Questions WHERE [FkSection] = #SectionID ORDER BY Obsolete, ObsoleteDate Desc">
<SelectParameters>
<asp:ControlParameter ControlID="ddlSections" Name="SectionID" />
</SelectParameters>
</asp:SqlDataSource>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</asp:TabPanel>
There is no code behind affecting the gridview.

Grid display changes on re binding the grid

I have a grid on my aspx page.I have set its font property to small..
On page load it is all okay..
but once I perform some action like a delete activity given in the grid itself..and the grid is bound again by recalling the method to bind grid..
the grid seems to be bigger with big fonts.
What could be the trouble?
<asp:GridView ID="grdSMEList" runat="server" Width="100%" BorderWidth="1px" BorderStyle="Solid"
Font-Size="Small" AutoGenerateColumns="False" BorderColor="#ffcc00" RowStyle-BorderColor="#ffcc00"
AllowPaging="true" PageSize="10" OnPageIndexChanging="GrdDynamic_PageIndexChanging"
DataKeyNames="Resource Personnel No" OnRowCommand="GrdDynamic_RowCommand" RowStyle-BorderStyle="Solid"
RowStyle-BorderWidth="1px" GridLines="Both" Height="104px">
<PagerSettings NextPageText="&gt;&gt" PageButtonCount="5" PreviousPageText="&lt;&lt"
FirstPageText="" LastPageText="" Mode="Numeric" />
<PagerStyle HorizontalAlign="Right" Font-Size="Medium" />
<Columns>
<asp:BoundField DataField="Resource Personnel No" HeaderText="Resource Personnel No" ItemStyle-Width="100px" />
<asp:BoundField DataField="RES Name" HeaderText="ResourceName" ItemStyle-Width="100px" />
<asp:TemplateField HeaderText="Deactivate" >
<ItemTemplate>
<div style="text-align:center;">
<asp:LinkButton ID="linkDeactivate" CommandName="cmdDeactivate" OnRowCommand="GrdDynamic_RowCommand"
CommandArgument='<%# Eval("Resource Personnel No") %>' OnClientClick="return confirm('Are you sure you want to Deactivate?');"
runat="server">Deactivate</asp:LinkButton>
</div>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" Width="2%" />
</asp:TemplateField>
</Columns>
</asp:GridView>
Did you try specifying the font color in ItemTemplate ? Its worth a try.

set column width of a gridview in asp.net

I dragged and dropped a GridView from toolbox to Aspx page.the design code looks like this
<asp:GridView ID="gridview1" runat="server" style="text-align:center;width: 1327px;"
CellPadding="4" ForeColor="#333333" GridLines="None" AllowPaging="True"
EnableSortingAndPagingCallbacks="True" PageSize="50" AutoGenerateEditButton="True">
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
<EditRowStyle BackColor="#999999" />
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center"
Height="12px" VerticalAlign="Bottom" Width="12px" Wrap="False" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#E9E7E2" />
<SortedAscendingHeaderStyle BackColor="#506C8C" />
<SortedDescendingCellStyle BackColor="#FFFDF8" />
<SortedDescendingHeaderStyle BackColor="#6F8DAE" />
</asp:GridView>
I have a column by name Address in database.The table is bound to this grid view using following VB.NET code
Dim ds as Data.DataSet
Dim da As New OleDbDataAdapter("select col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,Address from table, con)
da.Fill(ds)
gridviewrealestate.DataSource = ds
gridviewrealestate.DataBind()
Now,When the gridview is displayed,the columns are very close to each other due to large information present in Address Column.I want to set the Address Column to a particular width.
Please help me how to do this.
<asp:GridView ID="GridView1" runat="server">
<HeaderStyle Width="10%" />
<RowStyle Width="10%" />
<FooterStyle Width="10%" />
<Columns>
<asp:BoundField HeaderText="Name" DataField="LastName"
HeaderStyle-Width="10%" ItemStyle-Width="10%"
FooterStyle-Width="10%" />
</Columns>
</asp:GridView>
I know this is an old Question, but it popped up when I was looking for a solution to the same issue, so I thought that I would post what worked for me.
<asp:BoundField DataField="Description" HeaderText="Bond Event" ItemStyle-Width="300px" />
I used the ItemStyle-Width attribute on my BoundField and it worked very nicely I haven't had any issues yet.
I didn't need to add anything else to the rest of the code to make this work either.
Set width
HeaderStyle-width
for Example HeaderStyle-width="10%"
This what worked for me. set HeaderStyle-Width="5%", in the footer set textbox
width Width="15",also set the width of your gridview to 100%. following is the one of the column of my gridview.
<asp:TemplateField HeaderText = "sub" HeaderStyle-ForeColor="White" HeaderStyle-Width="5%">
<ItemTemplate>
<asp:Label ID="sub" runat="server" Font-Size="small" Text='<%# Eval("sub")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_sub" runat="server" Text='<%# Eval("sub")%>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txt_sub" runat="server" Width="15"></asp:TextBox>
</FooterTemplate>
You need to convert the column into a 'TemplateField'.
In Designer View, click the smart tag of the GridView, select-> 'Edit columns'.
Select your column you wish to modify and press the hyperlink converting it to a template. See screenshot:
Converting column to template.
Note: Modifying your datasource might regenerate the columns again, so it might make changes to your template columns.
Ref: https://msdn.microsoft.com/en-us/library/bb288032.aspx
Add HeaderStyle-Width and ItemStyle-width to TemplateFiels
<asp:GridView ID="grdCanceled" runat="server" AutoGenerateColumns="false" OnPageIndexChanging="grdCanceled_PageIndexChanging" AllowPaging="true" PageSize="15"
CssClass="table table-condensed table-striped table-bordered" GridLines="None">
<HeaderStyle BackColor="#00BCD4" ForeColor="White" />
<PagerStyle CssClass="pagination-ys" />
<Columns>
<asp:TemplateField HeaderText="Mobile NO" HeaderStyle-Width="10%" ItemStyle-Width="10%">
<ItemTemplate>
<%#Eval("mobile") %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Name" HeaderStyle-Width="10%" ItemStyle-Width="10%">
<ItemTemplate>
<%#Eval("name") %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="City" HeaderStyle-Width="10%" ItemStyle-Width="10%">
<ItemTemplate>
<%#Eval("city") %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Reason" HeaderStyle-Width="25%" ItemStyle-Width="25%">
<ItemTemplate>
<%#Eval("reson") %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Agent" HeaderStyle-Width="10%" ItemStyle-Width="10%">
<ItemTemplate>
<%#Eval("Agent") %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Date" HeaderStyle-Width="10%" ItemStyle-Width="10%">
<ItemTemplate>
<%#Eval("date","{0:dd-MMM-yy}") %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="DList" HeaderStyle-Width="10%" ItemStyle-Width="10%">
<ItemTemplate>
<%#Eval("service") %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="EndDate" HeaderStyle-Width="10%" ItemStyle-Width="10%">
<ItemTemplate>
<%#Eval("endDate","{0:dd-MMM-yy}") %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-Width="5%" ItemStyle-Width="5%">
<ItemTemplate>
<asp:CheckBox data-needed='<%#Eval("userId") %>' ID="chkChecked" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
There are two steps:
You must set an appropriate width for GridView like this: Width="2000px".
You can set width of Colum by setting [ItemStyle-Width] Like this: ItemStyle-Width="300px".
** You can set width by setting fixed Pixels like "150 px" or by percentage like"10%".
<asp:BoundField DataField="ElementName" HeaderText="RBI GL Name" ItemStyle-Horizontal ItemStyle-Width="50px" HeaderStyle-Width="50px"/>

Compilation Error after deoplyment. Doesn't recognize 'Theme' attribute

My local copy works fine, then I publish the website and I get this error.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30456: 'Theme' is not a member of 'ASP.invoice_aspx'.
Source Error:
Line 1: <%# page title="Invoice" language="VB" masterpagefile="~/MasterPage.master" autoeventwireup="false" inherits="Invoice, App_Web_1d5eb-af" theme="Default" %>
Line 2:
Line 3: <asp:Content ID="Content1" ContentPlaceHolderID="Head" Runat="Server">
Source File: C:\Inetpub\eSolutions_xyAMP_DEV\Invoice.aspx Line: 1
What is going on here?
HTML SOURCE
<%# Page Title="Invoice" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Invoice.aspx.vb" Inherits="Invoice" Theme="Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table style="width:100%;">
<tr>
<td align="center">
<asp:panel id="pnl" runat="server"
Width="992px" Wrap="False" HorizontalAlign="Center" >
<asp:Button id="btnPrepareInvoice" runat="server" Text="Trial Invoice" ></asp:Button>
<asp:Button id="btnFinalize" runat="server" Text="Final Invoice" ></asp:Button>
</asp:panel>
</td>
</tr>
</table>
<br />
<table width="100%">
<tr>
<td class="Subhdr" align="center" >
<asp:Label ID="Label7" Cssclass="ScreenHdr" runat="server" Font-Bold="True"
Font-Size="Medium" Height="24px"
Width="221px">Issued Contracts</asp:Label>
</td>
</tr>
</table>
<asp:datagrid id="dgrContracts"
runat="server" HorizontalAlign="Center" BorderColor="#C0C0FF"
ForeColor="Blue" Font-Size="8pt" Font-Bold="True" BorderWidth="1px"
BorderStyle="Solid" Font-Names="Arial"
ShowFooter="True" OnPageIndexChanged="IssueDataGrid_Page"
OnSortCommand="IssueDataGrid_Sort" AllowPaging="True" CellPadding="2"
GridLines="Horizontal" AutoGenerateColumns="False"
AllowSorting="True" OnItemCommand="IssueDataGrid_Command" Width="100%">
<FooterStyle Wrap="False" HorizontalAlign="Left" VerticalAlign="Top"></FooterStyle>
<SelectedItemStyle Wrap="False" BackColor="#E0E0E0"></SelectedItemStyle>
<EditItemStyle Wrap="False"></EditItemStyle>
<AlternatingItemStyle Font-Size="8pt" Font-Bold="True" Wrap="False" HorizontalAlign="Left" Height="18px"
BorderWidth="1px" ForeColor="#0000C0" BorderStyle="Solid" BorderColor="#C0C0FF" VerticalAlign="Middle"
></AlternatingItemStyle>
<ItemStyle Font-Size="8pt" Font-Names="Arial" Font-Bold="True" Wrap="False" HorizontalAlign="Left"
Height="18px" ForeColor="#0000C0" VerticalAlign="Middle"></ItemStyle>
<HeaderStyle Font-Size="8pt" Font-Names="Arial" Font-Bold="True" Wrap="False" HorizontalAlign="Left"
Height="18px" ForeColor="White" BackColor="Blue"></HeaderStyle>
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Button id="btnSelect" runat="server" Width="13px" BackColor="Yellow" ForeColor="White"
Height="13px" CommandName="Select"></asp:Button>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="MBI_Selected"></asp:BoundColumn>
<asp:BoundColumn DataField="CUST_CombinedNumber" SortExpression="CUST_CombinedNumber" HeaderText="Number">
<HeaderStyle Width="60px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="CUST_Name" SortExpression="CUST_Name" HeaderText="Name" HeaderStyle-Width="110px" />
<asp:BoundColumn DataField="DisplayDate" SortExpression="MBI_Date" HeaderText="Effective">
<HeaderStyle Width="80px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="VEHL_Year" HeaderText="Year">
<HeaderStyle Width="30px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="DisplayMake" HeaderText="Make">
<HeaderStyle Width="100px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="VEHL_Model" HeaderText="Model">
<HeaderStyle Width="120px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="MBI_PlanCode" HeaderText="Plan">
<HeaderStyle Width="30px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="DisplayExchangePrice" HeaderText="Exch">
<HeaderStyle Width="30px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="MBI_DlrCost" HeaderText="Cost" DataFormatString="{0:C}">
<HeaderStyle Width="30px"></HeaderStyle>
</asp:BoundColumn>
</Columns>
<PagerStyle VerticalAlign="Top" NextPageText=">>>>" Height="18px" PrevPageText="<<<<"
HorizontalAlign="Left" ForeColor="White" BackColor="Blue" Wrap="False"></PagerStyle>
</asp:datagrid>
<table width="100%">
<tr>
<td class="Subhdr" align="center" >
<asp:Label ID="Label1" Cssclass="ScreenHdr" runat="server" Font-Bold="True"
Font-Size="Medium" Height="24px"
Width="221px">Cancelled Contracts</asp:Label>
</td>
</tr>
</table>
<asp:datagrid id="dgrCancels"
runat="server" HorizontalAlign="Center" BorderColor="#C0C0FF"
ForeColor="Blue" Font-Size="8pt" Font-Bold="True" BorderWidth="1px"
BorderStyle="Solid" Font-Names="Arial" PageSize="5" ShowFooter="True" OnPageIndexChanged="CancelDataGrid_Page"
OnSortCommand="CancelDataGrid_Sort" AllowPaging="True" CellPadding="2"
GridLines="Horizontal" AutoGenerateColumns="False" AllowSorting="True"
OnItemCommand="CancelDataGrid_Command" Width="100%">
<FooterStyle Wrap="False" HorizontalAlign="Left" VerticalAlign="Top"></FooterStyle>
<SelectedItemStyle Wrap="False" BackColor="#E0E0E0"></SelectedItemStyle>
<EditItemStyle Wrap="False"></EditItemStyle>
<AlternatingItemStyle Font-Size="8pt" Font-Bold="True" Wrap="False" HorizontalAlign="Left" Height="18px"
BorderWidth="1px" ForeColor="#0000C0" BorderStyle="Solid" BorderColor="#C0C0FF" VerticalAlign="Middle"
></AlternatingItemStyle>
<ItemStyle Font-Size="8pt" Font-Names="Arial" Font-Bold="True" Wrap="False" HorizontalAlign="Left"
Height="18px" ForeColor="#0000C0" VerticalAlign="Middle"></ItemStyle>
<HeaderStyle Font-Size="8pt" Font-Names="Arial" Font-Bold="True" Wrap="False" HorizontalAlign="Left"
Height="18px" ForeColor="White" BackColor="Blue"></HeaderStyle>
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Button id="btnCancelSelect" runat="server" Width="13px" BackColor="Yellow" ForeColor="White"
Height="13px" CommandName="Select"></asp:Button>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn Visible="False" DataField="CNCL_ID">
<HeaderStyle Width="0px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="CNCL_Selected"></asp:BoundColumn>
<asp:BoundColumn DataField="CUST_CombinedNumber" SortExpression="CUST_CombinedNumber" HeaderText="Number">
<HeaderStyle Width="60px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="CUST_Name" SortExpression="CUST_Name" HeaderText="Name">
<HeaderStyle Width="200px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="DisplayIssueDate" SortExpression="MBI_Date" HeaderText="Effective">
<HeaderStyle Width="80px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="DisplayCancelDate" HeaderText="Cancel">
<HeaderStyle Width="80px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="MBI_Miles" HeaderText="Effective">
<HeaderStyle Width="60px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="CNCL_CancelMiles" HeaderText="Cancel">
<HeaderStyle Width="60px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="MBI_Price" HeaderText="Price" DataFormatString="{0:C}">
<HeaderStyle Width="40px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="CNCL_CalculatedNetRefund" HeaderText="Price Refund" DataFormatString="{0:C}">
<HeaderStyle Width="40px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="MBI_DlrCost" HeaderText="Cost" DataFormatString="{0:C}">
<HeaderStyle Width="40px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="CNCL_CalculatedNetAdminRefund" HeaderText="Cost Refund" DataFormatString="{0:C}">
<HeaderStyle Width="40px"></HeaderStyle>
</asp:BoundColumn>
</Columns>
<PagerStyle VerticalAlign="Top" NextPageText=">>>>" Height="18px" PrevPageText="<<<<"
HorizontalAlign="Left" ForeColor="White" BackColor="Blue" Wrap="False"></PagerStyle>
</asp:datagrid>
<asp:Label ID="Errormsg" runat="server" ForeColor="#CC0000" ></asp:Label>
</asp:Content>
I figured my problem here. I had a class named "Invoice" on my dbml as well as a page named "Invoice.aspx". This is a WebSite Project as opposed to a WebApplication so .net was correct in saying "Compiler Error Message: BC30456: 'Theme' is not a member of 'ASP.invoice_aspx'." blah blah. I wonder why this doesn't show up locally. This site was working fine on my local box, this was showing up after publishing the site to a server. Anyways, this is now working. I just renamed the aspx page and repubbed. <~~if thats a word. lol
Thanks,
~ck in San Diego
Go into the property pages of the deployment project. Under the Compilation tab, uncheck the option "Allow this precompiled site to be updatable". This resolved the problem for me.
Never seen this one before, but I would start by double checking the version setting on virtual directory or website to make sure it is targeting the correct runtime.
Try this:
http://arjansworld.blogspot.com/2006/11/aspnet-20-tip-theme-is-not-member-of.html
Can you put the HTML code up here to let us take a look? Are you sure you cleaned all old DLL's out of the directory you deployed to?
I had the same issue. This has nothing to do with Themes. Check duplicate DLLS in your bin folder. You could remove the
', App_Web_1d5eb-af'
part of your inherit statement. But the issue is a duplicate library in the bin folder, As soon as you identify and delete/move them the error will go away. If not delete them all and rebuild, some remaining legacy dll could be the issue.
I had a similar issue. I found the solution here.
The problem happens when there are 2 partial classes with the same name in the project. In my case, I had renamed Home.aspx.vb to Home-OLD.aspx.vb and replaced it with another page named Home.aspx (and codebehind file). The problem is that I didn't rename the class within Home-OLD.aspx.vb so I had 2 classes named Home in the project.
I ended up commenting out the old Home-OLD.aspx and Home-OLD.aspx.vb code for now and it worked.
If you have validated you don't have a class name collision and you are using a dynamic compilation website, you may need to clear out the Temp ASP files. Review the full path of the error to the .dll and delete the folder it is contained in.
C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\ [your site] \ [random number] \ [your site dlls]
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\ [your site] \ [random number] \ [your site dlls]

Resources