GridWeb.TableItemStyle.CssClass property

How exactly does the CssClass property work in the TableItemStyle class? I have a css file defined for the page and added a few styles that I want to use in the grid.

e.g.
.acwDay
{font:Arial, Helvetica, sans-serif;
color:Black;
font-weight:bold;
background-color:Yellow;
font-size:16;}

Then I write my code as:
Aspose.Cells.GridWeb.TableItemStyle dayStyle = new Aspose.Cells.GridWeb.TableItemStyle();
dayStyle.CssClass = "acwDay";

sheet.Cells[iRow, 1].Style = dayStyle;

The style does not show up.

This method is obviously not the way to do it.
Can you show me the right way?
I don't want to programmatically add each indiviidual style. I would prefer that they be in an external file like the css file above.

The style does work on other tags in the page.


This message was posted using Aspose.Live 2 Forum

Hi,

<?xml:namespace prefix = u1 /><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Well, setting style works fine. We added the following css style into section of aspx:

<style type="text/css">

.acwDay

{font:Arial, Helvetica, sans-serif;

color:Black;

font-weight:bold;

background-color:Yellow;

font-size:16;}

</style>

And set css class to TableItemStyle in code behind:

if (!IsPostBack)

{

Aspose.Cells.GridWeb.TableItemStyle dayStyle = new Aspose.Cells.GridWeb.TableItemStyle();

dayStyle.CssClass = "acwDay";

WebWorksheet sheet = GridWeb1.WebWorksheets[0];

sheet.Cells[1, 1].Style = dayStyle;

}

The style works fine. Please try it and let us know if it works fine for you.

Thank You & Best Regards,

The issue must be deeper than that.

I can not get the Grid to be editable. I have been able to put data in the grid.

I have this simple code:

protected void Page_Load(object sender, EventArgs e)
{
Aspose.Cells.GridWeb.License lic = new Aspose.Cells.GridWeb.License();
if (!IsPostBack)
{
lic.SetLicense("Aspose.Total.lic");
GridWeb1.WebWorksheets.Clear();
GridWeb1.WebWorksheets.Add();

//set sheets selectedIndex to 0
GridWeb1.WebWorksheets.ActiveSheetIndex = 0;
GridWeb1.ForceValidation = false;
GridWeb1.EditMode = true;
}
}

And the Grid is created without any options.
<acw:GridWeb ID="GridWeb1" runat="server">
</acw:GridWeb>

I can not edit any of the grid's cells.

Any suggestions?

Hi,

I tried your code and it works absolutely fine.

I have used the latest version/fix of Aspose.Cells.GridWeb, kindly try it.

If you still find the issue, kindly do create a sample project to show the issue.

Also give us more details about your environment, browser type, .NET framework, IIS settings or other extensions etc.


Thank you.

The Aspose.Cells.GridWeb.dll version is 2.0.3.2000.

I am using IE 8 on Windows XP SP 3.

I can run the Edit/Read Only demo on your website (http://www.aspose.com/demos/.net-components/aspose.cells/csharp/grid/common/modes.aspx) with no problems so I do not believe it is the browser.

Does the script manager affect GridWeb?

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function pageLoad() {
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<acw:GridWeb ID="GridWeb1" runat="server">
</acw:GridWeb>
</div>
</form>
</body>
</html>

Hi,

We will further look into your issue and get back to you soon.

Thank you.

Hi,



We have tested your scenario/code on Windows 7 with IE8 and it works
fine. We could not find the issue you have mentioned. Please try our
latest fix v2.0.3.14(we attached in previous post).



If you still find the issue, could you create a sample project, zip it
and post it here to reproduce the issue.



We will check it soon.



Thank you.