GridView Styling (CSS Classes) Disappears

Feb 18, 2010

I'm migrating a large number of stand-alone pages into content pages. Most of this involves little more than copying and pasting a GridView from one page into the new page. However, I find that styling disappears in the new project, i.e. the styles (as classes) are still present in the stylesheet, but these classes are no longer applied to GridView table elements. Example, in the old project, once a table is rendered by the GridView, its header row has a class of HeaderStyle, but in the new project this is lost, without any editing of the GridView. Is there some mysterious, built-in mechanism that automatically applies these attributes to GridView elements that I have somehow disabled?

View 1 Replies


Similar Messages:

Gridview Styling Not Rendering

Jan 19, 2010

Why is the following asp.net code not including styling information when being rendered to HTML?

<asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333"
GridLines="None">
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
Here is the HTML that is rendered:
<div class="AspNet-GridView" id="GridView1">
<table cellpadding="0" cellspacing="0" summary="">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Age</th>
<th scope="col">Sex</th>
</tr>
</thead>
<tbody>
<tr>
<td>Ronnie</td>
<td>25</td>
<td>M</td>
</tr>
<tr class="AspNet-GridView-Alternate">
<td>Tina</td>
<td>25</td>
<td>F</td>
</tr>
<tr>
<td>Lukus</td>
<td>4</td>
<td>M</td>
</tr>
</tbody>
</table>
</div>

There are no themes defined for this site. Any ideas what is going on? EDIT I created a new web site in VWD Express and copy and pasted my gridview code, which resulting in the following HTML being rendered:

<div>
<table cellspacing="0" cellpadding="4" border="0" id="GridView1" style="color:#333333;border-collapse:collapse;">
<tr style="color:White;background-color:#990000;font-weight:bold;">
<th scope="col">Name</th><th scope="col">Age</th><th scope="col">Sex</th>
</tr><tr style="color:#333333;background-color:#FFFBD6;">
<td>Ronnie</td><td>25</td><td>M</td>
</tr><tr style="color:#333333;background-color:White;">
<td>Tina</td><td>25</td><td>F</td>
</tr><tr style="color:#333333;background-color:#FFFBD6;">
<td>Lukus</td><td>4</td><td>M</td>
</tr>
</table>
</div>

Something is keeping styling information from being included in my original project.

View 2 Replies

Forms Data Controls :: Styling The Gridview Control

Aug 20, 2010

using .net 4 and vs 2010 I have a gridview control that refuses to wrap the text in one column in IE 8, Safari 5 and Chrome 5, resulting in the grid extending outside of the page wrapper. I've got it to behave in IE 7 by creating a CSS class like so:

[Code]....

FF and Opera seem to rendere it correctly without any styling whatsoever. I've tried using the <ItemStyle wrap="true" /> property with no success. I've tried setting the wrap property in the designer with no success.

View 2 Replies

Forms Data Controls :: Styling Columns In GridView From Stored Procedure?

Feb 16, 2010

Im loading some results from a SQL Stored procedure into a Grid View. From my stored procedure I simply get 2 columns returned, Details and Savings, the savings are being returned in the format 30.50123 I want to limit this to 2 decimal places and put a euro sign in front of it like so €30.50, I have managed to do this however its adding a new "savings"column to my Grid view which I obviously don't want. So I now have a savings column with the correct format of €30.50 and my 2 columns from my stored procedure

details and savings. Heres my code....

[Code]...

View 2 Replies

Forms Data Controls :: Gridview Styling - Compare The Value And Bold The Higher Value

Jun 25, 2010

I have a gridview control having the following columns.

ContestantID
Public Votes
Judges Votes
Public Percentage
Total
Schedular ID
Formula
4
200
1
51.282
330
2
130
3
190
2
48.718
450
2
260
2
1
??
25
1
1
??
1
3
??
75
3
1
??

On the basis of SchedularID i want to compare the value in column total and make the one with higher value as bold. But the problem is i am calculate the Total column at run time inside Row databound even. So any solutions?

[Code]....

View 6 Replies

Forms Data Controls :: GridView - Apply Same Styling For Two Continuous Rows

Jun 28, 2010

I have a grid view that always displays even number of rows. Is it possible to apply same styling for two contineous rows. So for example there would be different background color for rows no 1,2 and 3,4 I would prefer to do that in code behind.

View 4 Replies

Forms Data Controls :: Gridview Selection Styling - Set Row That Was Currently Selected To A Different Color

Jan 3, 2011

I have a gridview which i was trying to set the row that was currently selected to a different color.. i have used the SelectedRowStyle and works fine, but my needs are to highlight the row regardless of what button or link was clicked on within the row.. thats my description of "selected" i know that that the styles are based on events.. but i dont care if you click on edit, select, delete or any other button within the row.. i want to highlight the row so you know what record you are working with.. if i add the EditRowStyle, then if i selected row 5 it highlights.. no biggy, but with the edit row style, if i then click edit on row 2, then i have 2 records highlighted.. Is there not any way to determine if anything was done within a row and highlight it?

View 3 Replies

Forms Data Controls :: Gridview - Column Styling - Class To Define What Textbox Looks Like In Edit Mode

Jun 10, 2010

In the example below I have set the control style to 'controlName' I want to use this class to define what my textbox looks like in edit mode. This works ok, so far so good. The Problem In a button event I add the class "validationError" to this textbox if the data is incorrect. When the grid gets rendered I expect to get 'controlName validationError as the class applied to the textbox. Unfortunately, it seems that the declarative statement overrides this and simply ends up as 'controlName' how I can intercept the application of the declarative class so that I get what I desire here?

<asp:BoundField
DataField="Name"
HeaderStyle-CssClass="headerName"
ItemStyle-
CssClass="itemName"
ControlStyle-CssClass="controlName"
HeaderText="Name"
>
</asp:BoundField>

View 4 Replies

How To Use GridView Paging - Grid Disappears

Jan 23, 2010

I'm binding a dataview to a GridView and am trying to use GridView Paging. When I click on one of the page numbers, the Grid disappears.

Code:
If Page.IsPostBack = False
GridView1.AutoGenerateColumns = False
GridView1.AllowPaging = True
GridView1.PageSize = 5
[code]...

View 8 Replies

Visual Studio :: What Is The Difference Between Designer Classes And T4 Template Generated Classes

Jan 11, 2010

I am new to LINQ. when we drag tables we get a dbml file and designer file.

For example DataClasses1.dbml and DataClasses1.designer.cs.

Once we have them then we can start using our LINQ Queries.

In my company project I do not see this designer files and instead there are .tt files which were used as templates to greate ABC.generated.cs files. Is this same as designer class?

View 3 Replies

C# - Class Structure With LINQ, Partial Classes, And Abstract Classes

May 17, 2010

I am following the Nerd Dinner tutorial as I'm learning ASP.NET MVC, and I am currently on Step 3: Building the Model. One part of this section discusses how to integrate validation and business rule logic with the model classes. All this makes perfect sense. However, in the case of this source code, the author only validates one class: Dinner.

What I am wondering is, say I have multiple classes that need validation (Dinner, Guest, etc). It doesn't seem smart to me to repeatedly write these two methods in the partial class:

[code]....

This doesn't "feel" right, but I wanted to check with SO to get opinions of individuals smarter than me on this. I also tested it out, and it seems that the partial keyword on the OnValidate method is causing problems (understandably so). This doesn't seem possible to fix (but I could very well be wrong).

View 1 Replies

C# - Can Base Classes See The Protected Fields Of Derived Classes

Aug 11, 2010

I don't know if this has to do with how FindControl works or how scope works. But my base class is having a hard time seeing the fields of child classes. Currently I'm planning have the derived class set a property in the base class, but there are a lot of derived classes, so that isn't a very attractive solution.

[code]....

View 4 Replies

Forms Data Controls :: Gridview Check Missing 1st One With Gridview Helper Classes

Feb 23, 2010

im reading checkbox value which is checked on my gridview but as per my code is missing the 1st one which on top but i select from the middle then it is working fine here is link for gridviewhelper classes [URL] and im calling this code from gridviewhelper classes on page load event

Dim helper As New GridViewHelper(Me.GridView2)
helper.RegisterGroup("heading", True, True)
AddHandler helper.GroupHeader, AddressOf helper_GroupHeader

and here is my code

Dim sc As New StringCollection()
Dim id As String = String.Empty
For i As Integer = 0 To GridView2.Rows.Count - 1
'loop the GridView Rows
Dim cb As CheckBox = DirectCast(GridView2.Rows(i).Cells(2).FindControl("CheckBox2"), CheckBox)
'find the CheckBox
If cb IsNot Nothing Then
If cb.Checked Then
id = GridView2.Rows(i).Cells(1).Text
sc.Add(id)
MsgBox(id)
End If
End If
Next

View 1 Replies

AJAX :: Cursor Disappears After Editing GridView In An UpdatePanel?

Jan 13, 2011

I have setup a gridview within an update panel, which resides in a tabcontainer. After I edit any of the rows within the gridview and hit "update" the page reloads and I am no longer able to edit any of the text boxes in the other tabs, and if I attempt to insert or edit a row within the same gridview I'm not able to edit those either. That said, when I hit the tab key a couple of times the cursor appears and I'm able to proceed with editing. Based on the number of times I hit the tab button, it appears that the cursor was inside the textbox I clicked, though it wasn't visible and I simply wasn't able to enter any text.

I've been trying to setFocus on a specific field after any of the grid updates, also tried setting the cursor using ScriptManager.GetCurrent(Me).SetFocus(Me.Control) with no luck.

View 1 Replies

Forms Data Controls :: GridView Disappears After Postback?

Jan 13, 2010

I have a gridview where in the users are allowed to edit certain data and there is an update on top of the page which will send out all the changes made inside the GridView. But, the problem is , as soon as the update button is clicked, the grid disappearsand no update is made. This problem occurs when the size of the data on the page is huge. When we have less amount of data on the gridview, It does update. But, when there is a huge amount of data on the gridview, it does not. We have tried to increase the page size on the server, but to no use.

View 3 Replies

Search GridView Disappears On Navigate Button Click?

Jun 22, 2015

On my Form I have 2 gridviews namely; gvCRSearch (that displays search results) and gvCRView (that displays all the change requests raised).. Now, when the records are more than 10 in gvCRSearch it automatically creates a navigation number i.e., 1 2 3 Same thing happens to gvCRView

What is wrong is that when I click the navigation i.e., ( for example 2) on gvCRSearch

1) the gvCrSearch becomes visible = false

2) the gvCRView if it has a navigation number is moved to 2

So the effect is seen the next view (gvCRView) and the gridview (gvCRSearch becomes invisible)

the asp is as shown;

Code:
<asp:GridView ID="gvCRSearchView" runat="server" ShowHeader="True" AutoGenerateColumns="False" DataSourceID="CRSearch"
BackColor="White" BorderColor="#600000" BorderStyle="Solid" BorderWidth="2px" CellPadding="3" Font-Size="89.5%"
ForeColor="Black" GridLines="Vertical" AllowPaging="True" PageSize = "10" AllowSorting ="true" CssClass = "MainGridView">
<Columns>

[code]....

View 1 Replies

Data Controls :: GridView Using SqlDataSource / Disappears On PostBack?

Oct 1, 2013

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

[code]....

my data in gridview4 disappears when i click add to cart it shows no data  again i have to pass a query from gridview 3 and then gridview 4 appears and then again if i click on add to cart in gridview 4 it shows no data.

View 1 Replies

Forms Data Controls :: Gridview Disappears On Rowediting - How To Display It

Jul 24, 2010

I'm trying to figure out why my gridview disappears when I trigger the rowediting event.

The Gridview:

[Code]....

The code-behind:

[Code]....

When I click on the edit linkbutton, the gridview disappears. What is going wrong?

View 13 Replies

Forms Data Controls :: Gridview Disappears When Select Or Sort Used?

Jan 18, 2011

I use Server.Transfer("pagename", True) to navigate from a page where two dates have been selected to a page with a gridview that uses the dates to query the database and display the results. The gridview initially displays correctly but when I operate the select or sort it disappears.

View 8 Replies

Forms Data Controls :: Coloring Disappears On Postback (Gridview)?

Feb 23, 2010

I've got a Gridview in which I use the RowDataBound handler to color the lines according to certain conditions

(ie if column x is value y then change the background-color of the row to z etc).

One problem though, as soon as I do a postback the coloring disappears altogether and all rows become white.

Is there some way around this so I can retain my background colors even after a postback?

View 14 Replies

Forms Data Controls :: DropDownList Disappears From Gridview On RowUpdating?

Jan 21, 2011

I am populating a column in a gridview with a dropdownlist as follows:

[Code]....
[Code]....

When I edit the gridrow, the dropdown is there and I can select a new item.

But I can't find the dropdown during the rowupdated event. The cell control says it's a Textbox. All of the other items in the row are fine and I can get the data back. But I can't get the DropDown item.

Here are some of the things I have tried in the RowUpdating event:

DropDownList test = (DropDownList)e.FindControl("ddlPeriod");
//null
DropDownList ddl = (DropDownList)GridView1.Rows[e.RowIndex].FindControl("ddlPeriod");
//Also null
var test = row.Cells[8].Controls[0];
//Says its a textbox.

View 5 Replies

Web Forms :: Using C# Classes Vb Classes Together In VS2008 / 3.5 Project

Mar 24, 2010

Can I use VB and C# classes together in the same asp.net 3.5 project?

View 3 Replies

Forms Data Controls :: Gridview Custom Header Disappears On Postback

Jun 1, 2010

I have a datarepeater inside which I load a gridview. After the grid's binding is done I create an extra header line to group the columns (that's the only way I could do it, I couldn't figure a way to add an event for a control inside the repeater).That works fine and the page displays perfectly.However everytime I do a postback from other controls, I lose the 2nd header and 1 extra empty line appears at the top of the gridview

View 5 Replies

Forms Data Controls :: GridView W/ Dynamic BoundFields Disappears On Postback In IE Only?

May 4, 2010

have an ASP.net 4.0 page containing a GridView, where during the Page_Init event I'm dynamically adding BoundField columns to the gridview. I also have some custom sorting and paging methods that I use with this gridview, which result in postbacks on the page. In Chrome, Firefox, Safari, and Opera the gridview behaves as expected. HOWEVER, in IE 6, 7, or 8 when I click to sort a column in the gridview, or go to the next page of results in the gridview, it does not bind on postback, returning nothing back to the browser. Again, in anything but Internet Explorer, paging and sorting (frankly any postback event) brings back the gridview in its expected state. I only have the problem in IE. Relevant snippets of my code follow, where you'll see my Page_Init event calling a method in my WebFunctions class to add the BoundField columns for the table I pass to it, and my Page_Load event that calls the method in the user control responsible for binding my dataset to the gridview. Initial page load works in all browsers, but postback loading of the gridview only works in non-IE browsers.

[Code]....

View 4 Replies

Styling A Gridview "Caption" From C# Class

Oct 4, 2010

I'm trying to style the caption of a ASP.Net GridView in a C# file. here is my method that returns a styled GridView:

private GridView setupGridView(string caption)
{
var gview = new GridView()
{
BackColor = Color.White,
BorderColor = Color.Gray,
BorderStyle = BorderStyle.Solid,
BorderWidth = new Unit(1, UnitType.Pixel),
Caption = caption,
ForeColor = Color.Black,
};
gview.HeaderStyle.BackColor = Color.Navy;
gview.HeaderStyle.ForeColor = Color.White;
gview.HeaderStyle.BorderColor = Color.DarkGray;
gview.HeaderStyle.BorderWidth = new Unit(1, UnitType.Pixel);
gview.HeaderStyle.BorderStyle = BorderStyle.Solid;
gview.AlternatingRowStyle.BackColor = Color.LightGray;
return gview;
}

By default the Caption is not styled (it's just black text on top of the gridview) Does anyone know how I can style the Caption Navy with white text? (similar to the way I have styled the header row maybe?) EDIT: I've done this before by using CSS, but I don't have the liberty of doing that as, this is a program that generates gridviews to send in an email. There is no aspx file or skin...

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved