I am attempting to apply a custom font to the asp gridview that is nested in an iframe. We are using shtml to link pages together. The css was loaded by previous processing, however it was not being recognized forcing me to put a link on my page.
The font-face source items are duplicates of another css definition, so the paths are correct and work on the rest of the site. The background color is recognized, so I know the css is being evaluated. If another font is listed in the font-family, it is recognized and used.
I'm at a loss as to why the custom font that duplicates an existing css is not recognized. I'm focused on the issue relates to the iframe, but am unable to locate a resolution on this issue.
Thanks in advance
iframe statement used to load the asp page
<iframe id="ff" width="546px" height="200px" frameborder="0" scroll="yes" src="Career_JobListings.aspx"></iframe>
ASP code:
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Career_JobListings.aspx.cs" Inherits="_Default" %>
<form runat="server" id="f1">
<div class="gridview">
<asp:sqldatasource id="jobListingsDS" runat="server"
selectcommand="SELECT JobID, JobName, JobDescription, FileLink FROM tblJobListings"
connectionstring="<%$ ConnectionStrings:dbConnectionString %>">
</asp:sqldatasource>
<h2>A listing of current job openings.</h2>
<asp:gridview id="grdJobListings" runat="server" autogeneratecolumns="false"
datasourceid="jobListingsDS"
onrowdatabound="jobListingsGridView_RowDataBound"
cssclass="gridview">
<Columns>
<asp:BoundField ItemStyle-Width="150px" ReadOnly="True" DataField="JobName" HeaderText="Job Name" SortExpression="JobName"/>
<asp:BoundField ItemStyle-Width="250px" DataField="JobDescription" HeaderText="Description" />
<asp:HyperLinkField HeaderText="Detailed Description" Text='Click for detailed description.' NavigateUrl='f<%# bind("FileLink")%>' Target="_blank" runat="server"/>
</Columns>
</asp:gridview>
</div>
</form>
CSS Information:
#font-face {
font-family: MuseoSlab;
src: url(fonts\Museo_Slab_900.otf);
src: url(fonts\Museo_Slab_900.ttf);
src: url(fonts\Museo_Slab_900.eot);
}
/* ASP usage */
.gridview {
font-family: MuseoSlab;
}
.gridview tr {
font-family: MuseoSlab;
background-color: #FF6600;
}
I had utilized a previous css and created a new one with the essential font and class items for my grid. It turns out that the resolution was a missing import.
The following was added to the top of the css and now the custom font is being applied.
#import url("framework.css");
Hope this helps others that encounter this issue.
Related
So, how to remove this icon from RadWindow content? Is it able to remove that?
Here is my aspx code for delete confirmation.
<telerik:GridButtonColumn UniqueName="DeleteCommandColumn" ConfirmText="Are you sure want to send this deletion for Approval?" ConfirmDialogType="RadWindow" ButtonType="FontIconButton" CommandName="Delete" />
<telerik:RadWindowManager RenderMode="Lightweight" ID="DeleteConfirmation" runat="server" Width="500px" Height="250px" Modal="true" Behaviors="Close, Move" EnableShadow="true" />
And, how to resize the radwindow, because the width and height not working.
Thanks for your help!:)
You can hide the questionmark font icon which is used with the Lightweight render mode using the following CSS class:
.RadWindow .rwConfirmDialog:before {
content: "" !important;
}
or
.RadWindow .rwConfirmDialog:before {
content: none !important;
}
i want to ask how i can apply style on asp tags by using stylesheet???
For example i want to style a asp button control like following
<asp:Button ID="btnhme" runat="server" Text="Home" Width="145px"
BackColor="#3399FF" />
i know i can style it by using its properties but i want that if i have 10 buttons in my page then same style is apply to all buttons automatically and i have to do it for my all pages buttons and labels controls and i cannot set properties for all separately
is there is a solution by using stylesheet and if not by using stylesheet then what should i do that the style apply to all button controls and textbox,labels controls also
<asp:Label ID="lbllogin" runat="server" Text="LogIn Here"></asp:Label>
<asp:TextBox ID="txtuser" runat="server"></asp:TextBox>
please guide me how i can solve this issue
Thanx :)
Add the CssClass property to the Button control, for example, and add a corresponding class to the CSS file.
aspx
<asp:Button ID="btnhme" runat="server" Text="Home" Width="145px" BackColor="#3399FF" CssClass="my-buttons" />
CSS
.my-buttons { background-color:#3399FF; }
well you could set default css for each element, this would automatically cause every control of this type to take on this css:
input[type=text] {
//styling
color:blue;
}
label {
//styling
color:blue;
}
or you could come up with your own css class and just attach it to the elements you want:
.myTextClass
{
//styling
color:blue;
}
.myLabelClass
{
//styling
color:blue;
}
then attach the class using the CssClass property:
<asp:Label ID="lbllogin" runat="server" Text="LogIn Here" CssClass="myLabelClass"></asp:Label>
<asp:TextBox ID="txtuser" runat="server" CssClass="myTextClass"></asp:TextBox>
You can register default skin for server controls with desired properties responsible for styling.
Look at this article: How to: Apply ASP.NET Themes
If the page theme does not include a control skin that matches the SkinID property, the control uses the default skin for that control type.
I want to change color of label which is in usercontrol.
as it in in usercontrol i'm failed to do this using css.
I did like following :
inside myusercontrol.ascx
<link href="StyleSheet1.css" rel="stylesheet" type="text/css" />
<asp:Label ID="Label2" runat="server" Text="user control"></asp:Label>
StyleSheet1.css
#Label2
{
color:red;
}
webform.aspx
<div>
<asp:Label ID="Label1" runat="server" Text="home" ></asp:Label>
<uc:myuc runat="server" ID="uc1" />
</div>
As in normal aspx page it is working fine but not on usercontrol please suggest
Never style against asp.net id:s since they might change in the markup. If you view source the label (rendered as a span) propably won´t have id="Label2" when it´s inside the usercontrol. Rather style it using a class or set clientidmode static if that suits your solution.
Try
uc1.Style["Color"] = "Red";
I am using a ASP .NET ListView with a MS SQL Database. I use the ListView to show the information and in the list view, there is an hyperlink which opens the editing window for the specific record in a jQuery Modal Dialog Box.
<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1">
<LayoutTemplate>
<div id="itemPlaceholder" runat="server"> </div>
</LayoutTemplate>
<ItemTemplate>
<!--More Items -->
<a name="Link" href="EditItem.aspx?id=<%# Eval("articleid")%>">Edit</a>
<!--More Items -->
</ItemTemplate>
</asp:ListView>
</div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:myConnectionString %>"
SelectCommand="SQL-SELECT-STATEMENT">
</asp:SqlDataSource>
<div>
And jQuery works by taking the link of each item which has the name "Link" and associating it with a dialog box.
<script type="text/javascript">
$(document).ready(function() {
$("a[name=Link]").each(function() {
var $link = $(this);
var $dialog = $('<div></div>')
.load($link.attr('href'))
.dialog({
autoOpen: false,
title: "Edit Article",
width: 500,
height: 550
});
$link.click(function() {
$dialog.dialog('open');
return false;
});
});
});
</script>
Everything worked as it should. Earlier all the records could be shown in one go but as the number of records grew, I needed a paging solution. DataPager for the rescue!
<asp:DataPager ID="DataPager1" runat="server" PagedControlID="ListView1" PageSize="5">
<Fields>
<asp:NextPreviousPagerField />
<asp:NumericPagerField />
</Fields>
</asp:DataPager>
But now the DataPager's controls are not working! I cannot go back,forward or click a page number as it will open the first data bound item's href in the ListView without a dialog box (Just like a normal page). But if i remove the jQuery code, the paging works as it should but I don't get the neat modal dialog box for my editing :(
Any ideas why these cannot exist with each other? Thanx a lot in advance :)
UPDATE: What doesn't work is that they cannot co-exist peacefully. If i remove the jQuery code, the DataPager works fine but I will lost my modal dialog box for editing. If i put the jQuery code back, the modal dialog box works fine but the DataPager doesn't :(
My guess is that link selector is probably selecting data pager links.
You can try $("a[name='Link']").each(.. note single quotes around attribute value.
Alternately, why don't you use id or class selectors. For example:
<a id="editLink" ...
and
$('a#editLink;).each(...
I'm trying to have one unified location where I may edit how my gridview columns will act and align. Specifically looking at the headerrow. I have certain columns containing text values, those should be left aligned values and headers. Other columns contain integers and should be right aligned both values and headers.
"On the first day" I thought all was good and well, Firefox/Chrome showed it precisely as desired, then the users came and saw everything was wrong (in their Explorers) (center aligned headers).
Hence I spent countless hours "and sleepness nights;)" googling away trying to find the solution to no avail.
How can I uniquely identify one header cell to be left aligned and another header cell to be right aligned?
I found the HeaderStyle-CssClass and ItemStyle-CssClass (latter is not that interesting in this specific case).
Problem is whenever I define the alignment in the CSS file
.HeaderStyle th { text-align: <value>; }
It supercedes any other setting there may be. Remember text items should be left, digits right aligned, incl header.
It would be no problem persay to incl a HeaderStyle-CssClass in the troubled areas,
though that would be rather bothersome to both support and maintain later.
The correct solution would be a single location that would define the alignments, as they should respectively as per design.
Could this be done with a skin in the themes folder?
For demonstration purposes
<%# Page Language="C#" AutoEventWireup="true" CodeFile="GridviewAlignments.aspx.cs"
Inherits="GridviewAlignments" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Testing GridView Alignment</title>
<style type="text/css">
.LeftAlign
{
text-align: Left;
}
.NoneAlign
{
text-align: none;
}
.RightAlign
{
text-align: Right;
}
.JustifyAlign
{
text-align: justify;
}
.InheritAlign
{
text-align: inherit;
}
.HeaderStyle th
{
text-align: justify;
}
</style>
</head>
<body>
<form runat="server">
<asp:GridView runat="server" ID="TestAlign" ShowFooter="True" DataSourceID="testDataSource"
Width="600" CssClass="HeaderStyle">
<Columns>
<asp:BoundField DataField="left" HeaderText="-left-"
HeaderStyle-CssClass="LeftAlign" />
<asp:BoundField DataField="none" HeaderText="-none-"
HeaderStyle-CssClass="InheritAlign" />
<asp:BoundField DataField="right" HeaderText="-right"
HeaderStyle-CssClass="RightAlign" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="testDataSource" runat="server" TypeName="TestData" SelectMethod="GetTestGridData"></asp:ObjectDataSource>
</form>
</body>
</html>
Rather than using a specific CSS class tied to <th> to provide the default style for your header, you should use the HeaderStyle-CssClass property of the GridView.
.HeaderStyle {
text-align: justify
}
<asp:GridView runat="server" ID="TestAlign" ShowFooter="True"
DataSourceID="testDataSource" Width="600"
HeaderStyle-CssClass="HeaderStyle">
<Columns>
<asp:BoundField DataField="left" HeaderText="-left-"
HeaderStyle-CssClass="LeftAlign" />
<asp:BoundField DataField="none" HeaderText="-none-"
HeaderStyle-CssClass="InheritAlign" />
<asp:BoundField DataField="right" HeaderText="-right"
HeaderStyle-CssClass="RightAlign" />
</Columns>
</asp:GridView>
whenever I define the alignment in the CSS file
.HeaderStyle th { text-align: <value>; }
It supercedes any other setting there may be.
That's because the selector .HeaderStyle th is more ‘specific’ than just .RightAlign. In CSS the more stuff you put in the selector, the more ‘specific’ it is, and more-specific rules override less-specific ones. You can see the exact rules in the spec.
If you change the .RightAlign selector to .HeaderStyle .RightAlign, it is now more specific than .HeaderStyle th and will ‘win’.
Also note inherit doesn't work in IE.
Solution became to do some specific BoundFields eg.
TextField : BoundField,
NumberField : BoundField,
DateField : BoundField
In the constructor I put a this.HeaderStyle.CssClass = "TextBoundField"; (or the CSS item governing this particular Field)
Cos there is also a this.ItemStyle.CssClass = "TextBoundField";
The CSS then have a .TextBoundField { text-align: left; } (for text, right for number and dates).
Works sweet, even for IE. ;)
thx for your assistance.
Have you tried using a HeaderTemplate?
<Columns>
<asp:TemplateField>
<HeaderTemplate></HeaderTemplate>
</asp:TemplateField>
</Columns>
I'm not quite sure about it, but I think that this way you could set diferent classes for different headers.
Go to the columns properties of data grid view
select column you want to change alignment
then change Horizontal Alignment for each column you want to change (left or right)