|
Hi,
Try with the latest version of the Firefox.
Naresh Patel
|
|
|
|
|
<!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>
<title>Untitled Page</title>
<style type="text/css">
.gridFixedHeader{
background-color:red;
font-size: 9pt;
color: #FFFFFF;
position: relative;
font-family: Airal,sans-serif;
border:#0066CC;
z-index: 1;
overflow: auto;
width: 100%;
height: 120px;
}
.divStyle{
background-color:black;
width: 99%;
height: 400px;
}
</style>
</head>
<body>
<div id="div-datagrid" class='gridFixedHeader'>
<div class="divStyle">
</div>
</div>
</body>
</html>
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
I have tested with Firefox, Safari, Opera and IE7. I didn't see any problem with "overflow: auto; " CSS property.
I know you still have problem in using expression . I'm still looking for the solution.
For the time being, lets discuss about overflow only. I think that the code above works fine.
is it what you want or still having the problem in using that???
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Hi Mr.Michael Sync
thank u soo much i will try this method thank u once again..
Reg
nantha
|
|
|
|
|
Hi Mr.Michael Sync..
Thank u soo much ur code is working . but header for that grid also moving in Mozilla in IE header is fixed , but Mozilla header is moving .. so please try for this . thank soo much
Reg
nantha
|
|
|
|
|
Yeah. As I said, non-IE browsers (including Mozilla Firefox) doesn't support "CSS expression ". So, I was looking for the solution and I found that it's too wide to cover since the solution for one case are differ from the sol for another case even all are using expresion.
Okay. Here is the solution (98%) for your problem. (I said "98%" solution because this code won't work on IE7. )
The following code that I'm going to show is based on this great article Pure CSS Scrollable Table with Fixed Header[^] and Microsoft ASP.NET 2.0 CSS Friendly Control Adapters 1.0[^].
Let's start !!
#1. Download the template from http://www.asp.net/cssadapters/
#2. Install it in your machine. ( Check-out this page to know how to install )
#3. Open C# "CSS friendly adapter Template" in Visual Studio 2005
#4. Delete "WalkThru", "CSS" and "Javascript" folder.
#5. Delete all files (except GridViewAdapter and WebControlAdapterExtender ) in App_Code\Adapters.
#6. Put the code (I will post in next thread because the text editor here is really bad in aspx
#7. Pasted the code below in code-behinded file.
<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
GridView1.DataSource = getDataTable();<br />
GridView1.DataBind();<br />
}<br />
private DataTable getDataTable()<br />
{<br />
DataTable dt = new DataTable();<br />
<br />
DataColumn dc1 = new DataColumn("Header1");<br />
dt.Columns.Add(dc1);<br />
DataColumn dc2 = new DataColumn("Header2");<br />
dt.Columns.Add(dc2);<br />
DataColumn dc3 = new DataColumn("Header3");<br />
dt.Columns.Add(dc3);<br />
<br />
for(int i=0;i<50;i++){<br />
DataRow dr = dt.NewRow();<br />
dr[0] = i.ToString();<br />
dr[1] = i.ToString() + " Cell";<br />
dr[2] = i.ToString() + " Text";<br />
dt.Rows.Add(dr);<br />
}<br />
<br />
return dt;<br />
}
#8. Paste (override) the code below in GridViewAdapter.cs under App_Code\Adapters.
<br />
using System;<br />
using System.Data;<br />
using System.Collections;<br />
using System.Configuration;<br />
using System.Web;<br />
using System.Web.Security;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;<br />
using System.Web.UI.HtmlControls;<br />
<br />
namespace CSSFriendly<br />
{<br />
public class GridViewAdapter : System.Web.UI.WebControls.Adapters.WebControlAdapter<br />
{<br />
private WebControlAdapterExtender _extender = null;<br />
private WebControlAdapterExtender Extender<br />
{<br />
get<br />
{<br />
if (((_extender == null) && (Control != null)) ||<br />
((_extender != null) && (Control != _extender.AdaptedControl)))<br />
{<br />
_extender = new WebControlAdapterExtender(Control);<br />
}<br />
<br />
System.Diagnostics.Debug.Assert(_extender != null, "CSS Friendly adapters internal error", "Null extender instance");<br />
return _extender;<br />
}<br />
}<br />
<br />
<br />
protected override void OnInit(EventArgs e)<br />
{<br />
base.OnInit(e);<br />
<br />
if (Extender.AdapterEnabled)<br />
{<br />
RegisterScripts();<br />
}<br />
}<br />
<br />
protected override void RenderBeginTag(HtmlTextWriter writer)<br />
{<br />
if (Extender.AdapterEnabled)<br />
{<br />
Extender.RenderBeginTag(writer, "tableContainer");
}<br />
else<br />
{<br />
base.RenderBeginTag(writer);<br />
}<br />
}<br />
<br />
protected override void RenderEndTag(HtmlTextWriter writer)<br />
{<br />
if (Extender.AdapterEnabled)<br />
{<br />
Extender.RenderEndTag(writer);<br />
}<br />
else<br />
{<br />
base.RenderEndTag(writer);<br />
}<br />
}<br />
<br />
protected override void RenderContents(HtmlTextWriter writer)<br />
{<br />
if (Extender.AdapterEnabled)<br />
{<br />
GridView gridView = Control as GridView;<br />
if (gridView != null)<br />
{<br />
writer.Indent++;<br />
WritePagerSection(writer, PagerPosition.Top);<br />
<br />
writer.WriteLine();<br />
writer.WriteBeginTag("table");<br />
writer.WriteAttribute("cellpadding", "0");<br />
writer.WriteAttribute("cellspacing", "0");<br />
writer.WriteAttribute("summary", Control.ToolTip);<br />
<br />
if (!String.IsNullOrEmpty(gridView.CssClass))<br />
{<br />
writer.WriteAttribute("class", gridView.CssClass);<br />
}<br />
<br />
writer.Write(HtmlTextWriter.TagRightChar);<br />
writer.Indent++;<br />
<br />
ArrayList rows = new ArrayList();<br />
GridViewRowCollection gvrc = null;<br />
<br />
<br />
rows.Clear();<br />
if (gridView.ShowHeader && (gridView.HeaderRow != null))<br />
{<br />
rows.Add(gridView.HeaderRow);<br />
}<br />
gvrc = new GridViewRowCollection(rows);<br />
WriteRows(writer, gridView, gvrc, "thead");<br />
<br />
<br />
rows.Clear();<br />
if (gridView.ShowFooter && (gridView.FooterRow != null))<br />
{<br />
rows.Add(gridView.FooterRow);<br />
}<br />
gvrc = new GridViewRowCollection(rows);<br />
WriteRows(writer, gridView, gvrc, "tfoot");<br />
<br />
<br />
WriteRows(writer, gridView, gridView.Rows, "tbody");<br />
<br />
<br />
writer.Indent--;<br />
writer.WriteLine();<br />
writer.WriteEndTag("table");<br />
<br />
WritePagerSection(writer, PagerPosition.Bottom);<br />
<br />
writer.Indent--;<br />
writer.WriteLine();<br />
}<br />
}<br />
else<br />
{<br />
base.RenderContents(writer);<br />
}<br />
}<br />
<br />
<br />
private void RegisterScripts()<br />
{<br />
}<br />
<br />
private void WriteRows(HtmlTextWriter writer, GridView gridView, GridViewRowCollection rows, string tableSection)<br />
{<br />
if (rows.Count > 0)<br />
{<br />
writer.WriteLine(); <br />
writer.WriteBeginTag(tableSection);<br />
<br />
if (tableSection == "tbody")<br />
{<br />
<br />
writer.WriteAttribute("class", "scrollContent");<br />
<br />
}<br />
else if (tableSection == "thead")<br />
{<br />
<br />
writer.WriteAttribute("class", "fixedHeader");<br />
<br />
}<br />
<br />
writer.Write(HtmlTextWriter.TagRightChar);<br />
writer.Indent++;<br />
<br />
foreach (GridViewRow row in rows)<br />
{<br />
writer.WriteLine();<br />
writer.WriteBeginTag("tr");<br />
<br />
string className = GetRowClass(gridView, row);<br />
if (!String.IsNullOrEmpty(className))<br />
{<br />
writer.WriteAttribute("class", className);<br />
}<br />
<br />
<br />
<br />
writer.Write(HtmlTextWriter.TagRightChar);<br />
writer.Indent++;<br />
<br />
foreach (TableCell cell in row.Cells)<br />
{<br />
DataControlFieldCell fieldCell = cell as DataControlFieldCell;<br />
if ((fieldCell != null) && (fieldCell.ContainingField != null))<br />
{<br />
DataControlField field = fieldCell.ContainingField;<br />
if (!field.Visible)<br />
{<br />
cell.Visible = false;<br />
}<br />
<br />
if ((field.ItemStyle != null) && (!String.IsNullOrEmpty(field.ItemStyle.CssClass)))<br />
{<br />
if (!String.IsNullOrEmpty(cell.CssClass))<br />
{<br />
cell.CssClass += " ";<br />
}<br />
cell.CssClass += field.ItemStyle.CssClass;<br />
}<br />
}<br />
<br />
writer.WriteLine();<br />
cell.RenderControl(writer);<br />
}<br />
<br />
writer.Indent--;<br />
writer.WriteLine();<br />
writer.WriteEndTag("tr");<br />
}<br />
<br />
writer.Indent--;<br />
writer.WriteLine();<br />
writer.WriteEndTag(tableSection);<br />
}<br />
}<br />
<br />
private string GetRowClass(GridView gridView, GridViewRow row)<br />
{<br />
string className = "";<br />
<br />
if ((row.RowState & DataControlRowState.Alternate) == DataControlRowState.Alternate)<br />
{<br />
}<br />
else if (row.Equals(gridView.HeaderRow) && (gridView.HeaderStyle != null) && (!String.IsNullOrEmpty(gridView.HeaderStyle.CssClass)))<br />
{<br />
className += " " + gridView.HeaderStyle.CssClass;<br />
}<br />
else if (row.Equals(gridView.FooterRow) && (gridView.FooterStyle != null) && (!String.IsNullOrEmpty(gridView.FooterStyle.CssClass)))<br />
{<br />
className += " " + gridView.FooterStyle.CssClass;<br />
}<br />
else if ((gridView.RowStyle != null) && (!String.IsNullOrEmpty(gridView.RowStyle.CssClass)))<br />
{<br />
className += " " + gridView.RowStyle.CssClass;<br />
}<br />
<br />
if ((row.RowState & DataControlRowState.Edit) == DataControlRowState.Edit)<br />
{<br />
if (gridView.EditRowStyle != null)<br />
{<br />
className += gridView.EditRowStyle.CssClass;<br />
}<br />
}<br />
<br />
if ((row.RowState & DataControlRowState.Insert) == DataControlRowState.Insert)<br />
{<br />
}<br />
<br />
if ((row.RowState & DataControlRowState.Selected) == DataControlRowState.Selected)<br />
{<br />
if (gridView.SelectedRowStyle != null)<br />
{<br />
className += gridView.SelectedRowStyle.CssClass;<br />
}<br />
}<br />
<br />
return className.Trim();<br />
}<br />
<br />
private void WritePagerSection(HtmlTextWriter writer, PagerPosition pos)<br />
{<br />
GridView gridView = Control as GridView;<br />
if ((gridView != null) &&<br />
gridView.AllowPaging &&<br />
((gridView.PagerSettings.Position == pos) || (gridView.PagerSettings.Position == PagerPosition.TopAndBottom)))<br />
{<br />
Table innerTable = null;<br />
if ((pos == PagerPosition.Top) &&<br />
(gridView.TopPagerRow != null) &&<br />
(gridView.TopPagerRow.Cells.Count == 1) &&<br />
(gridView.TopPagerRow.Cells[0].Controls.Count == 1) &&<br />
typeof(Table).IsAssignableFrom(gridView.TopPagerRow.Cells[0].Controls[0].GetType()))<br />
{<br />
innerTable = gridView.TopPagerRow.Cells[0].Controls[0] as Table;<br />
}<br />
else if ((pos == PagerPosition.Bottom) &&<br />
(gridView.BottomPagerRow != null) &&<br />
(gridView.BottomPagerRow.Cells.Count == 1) &&<br />
(gridView.BottomPagerRow.Cells[0].Controls.Count == 1) &&<br />
typeof(Table).IsAssignableFrom(gridView.BottomPagerRow.Cells[0].Controls[0].GetType()))<br />
{<br />
innerTable = gridView.BottomPagerRow.Cells[0].Controls[0] as Table;<br />
}<br />
<br />
if ((innerTable != null) && (innerTable.Rows.Count == 1))<br />
{<br />
string className = "AspNet-GridView-Pagination AspNet-GridView-";<br />
className += (pos == PagerPosition.Top) ? "Top " : "Bottom ";<br />
if (gridView.PagerStyle != null)<br />
{<br />
className += gridView.PagerStyle.CssClass;<br />
}<br />
className = className.Trim();<br />
<br />
writer.WriteLine();<br />
writer.WriteBeginTag("div");<br />
writer.WriteAttribute("class", className);<br />
writer.Write(HtmlTextWriter.TagRightChar);<br />
writer.Indent++;<br />
<br />
TableRow row = innerTable.Rows[0];<br />
foreach (TableCell cell in row.Cells)<br />
{<br />
foreach (Control ctrl in cell.Controls)<br />
{<br />
writer.WriteLine();<br />
ctrl.RenderControl(writer);<br />
}<br />
}<br />
<br />
writer.Indent--;<br />
writer.WriteLine();<br />
writer.WriteEndTag("div");<br />
}<br />
}<br />
}<br />
}<br />
}<br />
#9. Then, run the application..
That's all. But note that it doesn't work on IE7. and you need to modify the code if your gridview has more/less than 3 columns. (Thanks to "Terence Ordona, portal[AT]imaputz[DOT]com" for CSS scrollable table.)
Note:
Browser Support (table is scrollable with fixed headers)
* Opera 7.x + (All Platforms) :: Tested with 7.2x and 7.5x
* Mozilla 1.x + (All Platforms) :: Tested with 1.0x and 1.6x
* IE 6.x + (Windows) :: Tested with 6.0x
* Safari 1.x + (MacOS) :: Tested with 1.2x
* Konqueror 3.x + (Linux / BSD) :: Tested with 3.2x
Almost works (table is scrollable)
* IE 5.x + (Windows) :: Tested with 5.0x and 5.5x
Doesn't work (table is not viewable)
* Opera 5.x and 6.x :: Tested with 5.1x and 6.x
* IE 5.x + (MacOS) :: Tested with 5.2x
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Paste it in default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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>Cross-browser Fixed Header in GridView</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="language" content="en-us" />
<script type="text/javascript">
<!--
/* http://www.alistapart.com/articles/zebratables/ */
function removeClassName (elem, className) {
elem.className = elem.className.replace(className, "").trim();
}
function addCSSClass (elem, className) {
removeClassName (elem, className);
elem.className = (elem.className + " " + className).trim();
}
String.prototype.trim = function() {
return this.replace( /^\s+|\s+$/, "" );
}
function stripedTable() {
if (document.getElementById && document.getElementsByTagName) {
var allTables = document.getElementsByTagName('table');
if (!allTables) { return; }
for (var i = 0; i < allTables.length; i++) {
if (allTables[i].className.match(/[\w\s ]*scrollTable[\w\s ]*/)) {
var trs = allTables[i].getElementsByTagName("tr");
for (var j = 0; j < trs.length; j++) {
removeClassName(trs[j], 'alternateRow');
addCSSClass(trs[j], 'normalRow');
}
for (var k = 0; k < trs.length; k += 2) {
removeClassName(trs[k], 'normalRow');
addCSSClass(trs[k], 'alternateRow');
}
}
}
}
}
window.onload = function() { stripedTable(); }
-->
</script>
<style type="text/css">
<!--
/* Terence Ordona, portal[AT]imaputz[DOT]com */
/* http://creativecommons.org/licenses/by-sa/2.0/ */
/* begin some basic styling here */
body {
background: #FFF;
color: #000;
font: normal normal 12px Verdana, Geneva, Arial, Helvetica, sans-serif;
margin: 10px;
padding: 0
}
table, td, a {
color: #000;
font: normal normal 12px Verdana, Geneva, Arial, Helvetica, sans-serif
}
h1 {
font: normal normal 18px Verdana, Geneva, Arial, Helvetica, sans-serif;
margin: 0 0 5px 0
}
h2 {
font: normal normal 16px Verdana, Geneva, Arial, Helvetica, sans-serif;
margin: 0 0 5px 0
}
h3 {
font: normal normal 13px Verdana, Geneva, Arial, Helvetica, sans-serif;
color: #008000;
margin: 0 0 15px 0
}
/* end basic styling */
/* define height and width of scrollable area. Add 16px to width for scrollbar */
div.tableContainer {
clear: both;
border: 1px solid #963;
height: 285px;
overflow: auto;
width: 756px
}
/* Reset overflow value to hidden for all non-IE browsers. */
html>body div.tableContainer {
overflow: hidden;
width: 756px
}
/* define width of table. IE browsers only */
div.tableContainer table {
float: left;
width: 740px
}
/* define width of table. Add 16px to width for scrollbar. */
/* All other non-IE browsers. */
html>body div.tableContainer table {
width: 756px
}
/* set table header to a fixed position. WinIE 6.x only */
/* In WinIE 6.x, any element with a position property set to relative and is a child of */
/* an element that has an overflow property set, the relative value translates into fixed. */
/* Ex: parent element DIV with a class of tableContainer has an overflow property set to auto */
thead.fixedHeader tr {
position: relative
}
/* set THEAD element to have block level attributes. All other non-IE browsers */
/* this enables overflow to work on TBODY element. All other non-IE, non-Mozilla browsers */
html>body thead.fixedHeader tr {
display: block
}
/* make the TH elements pretty */
thead.fixedHeader th {
background: #C96;
border-left: 1px solid #EB8;
border-right: 1px solid #B74;
border-top: 1px solid #EB8;
font-weight: normal;
padding: 4px 3px;
text-align: left
}
/* make the A elements pretty. makes for nice clickable headers */
thead.fixedHeader a, thead.fixedHeader a:link, thead.fixedHeader a:visited {
color: #FFF;
display: block;
text-decoration: none;
width: 100%
}
/* make the A elements pretty. makes for nice clickable headers */
/* WARNING: swapping the background on hover may cause problems in WinIE 6.x */
thead.fixedHeader a:hover {
color: #FFF;
display: block;
text-decoration: underline;
width: 100%
}
/* define the table content to be scrollable */
/* set TBODY element to have block level attributes. All other non-IE browsers */
/* this enables overflow to work on TBODY element. All other non-IE, non-Mozilla browsers */
/* induced side effect is that child TDs no longer accept width: auto */
html>body tbody.scrollContent {
display: block;
height: 262px;
overflow: auto;
width: 100%
}
/* make TD elements pretty. Provide alternating classes for striping the table */
/* http://www.alistapart.com/articles/zebratables/ */
tbody.scrollContent td, tbody.scrollContent tr.normalRow td {
background: #FFF;
border-bottom: none;
border-left: none;
border-right: 1px solid #CCC;
border-top: 1px solid #DDD;
padding: 2px 3px 3px 4px
}
tbody.scrollContent tr.alternateRow td {
background: #EEE;
border-bottom: none;
border-left: none;
border-right: 1px solid #CCC;
border-top: 1px solid #DDD;
padding: 2px 3px 3px 4px
}
/* define width of TH elements: 1st, 2nd, and 3rd respectively. */
/* Add 16px to last TH for scrollbar padding. All other non-IE browsers. */
/* http://www.w3.org/TR/REC-CSS2/selector.html#adjacent-selectors */
html>body thead.fixedHeader th {
width: 200px
}
html>body thead.fixedHeader th + th {
width: 240px
}
html>body thead.fixedHeader th + th + th {
width: 316px
}
/* define width of TD elements: 1st, 2nd, and 3rd respectively. */
/* All other non-IE browsers. */
/* http://www.w3.org/TR/REC-CSS2/selector.html#adjacent-selectors */
html>body tbody.scrollContent td {
width: 200px
}
html>body tbody.scrollContent td + td {
width: 240px
}
html>body tbody.scrollContent td + td + td {
width: 300px
}
-->
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:GridView ID="GridView1" runat="server" CssClass="scrollTable" Width="100%">
</asp:GridView>
<div id="tableContainer" class="tableContainer">
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="scrollTable">
<thead class="fixedHeader">
<tr>
<th><a href="#">Header 1</a></th>
<th><a href="#">Header 2</a></th>
<th><a href="#">Header 3</a></th>
</tr>
</thead>
<tbody class="scrollContent">
<tr>
<td>Cell Content 1</td>
<td>Cell Content 2</td>
<td>Cell Content 3</td>
</tr>
<tr>
<td>More Cell Content 1</td>
<td>More Cell Content 2</td>
<td>More Cell Content 3</td>
</tr>
<tr>
<td>Even More Cell Content 1</td>
<td>Even More Cell Content 2</td>
<td>Even More Cell Content 3</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
</tr>
<tr>
<td>Cell Content 1</td>
<td>Cell Content 2</td>
<td>Cell Content 3</td>
</tr>
<tr>
<td>More Cell Content 1</td>
<td>More Cell Content 2</td>
<td>More Cell Content 3</td>
</tr>
<tr>
<td>Even More Cell Content 1</td>
<td>Even More Cell Content 2</td>
<td>Even More Cell Content 3</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
</tr>
<tr>
<td>Cell Content 1</td>
<td>Cell Content 2</td>
<td>Cell Content 3</td>
</tr>
<tr>
<td>More Cell Content 1</td>
<td>More Cell Content 2</td>
<td>More Cell Content 3</td>
</tr>
<tr>
<td>Even More Cell Content 1</td>
<td>Even More Cell Content 2</td>
<td>Even More Cell Content 3</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
</tr>
<tr>
<td>Cell Content 1</td>
<td>Cell Content 2</td>
<td>Cell Content 3</td>
</tr>
<tr>
<td>More Cell Content 1</td>
<td>More Cell Content 2</td>
<td>More Cell Content 3</td>
</tr>
<tr>
<td>Even More Cell Content 1</td>
<td>Even More Cell Content 2</td>
<td>Even More Cell Content 3</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
</tr>
<tr>
<td>Cell Content 1</td>
<td>Cell Content 2</td>
<td>Cell Content 3</td>
</tr>
<tr>
<td>More Cell Content 1</td>
<td>More Cell Content 2</td>
<td>More Cell Content 3</td>
</tr>
<tr>
<td>Even More Cell Content 1</td>
<td>Even More Cell Content 2</td>
<td>Even More Cell Content 3</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
</tr>
<tr>
<td>Cell Content 1</td>
<td>Cell Content 2</td>
<td>Cell Content 3</td>
</tr>
<tr>
<td>More Cell Content 1</td>
<td>More Cell Content 2</td>
<td>More Cell Content 3</td>
</tr>
<tr>
<td>Even More Cell Content 1</td>
<td>Even More Cell Content 2</td>
<td>Even More Cell Content 3</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
</tr>
<tr>
<td>Cell Content 1</td>
<td>Cell Content 2</td>
<td>Cell Content 3</td>
</tr>
<tr>
<td>More Cell Content 1</td>
<td>More Cell Content 2</td>
<td>More Cell Content 3</td>
</tr>
<tr>
<td>Even More Cell Content 1</td>
<td>Even More Cell Content 2</td>
<td>Even More Cell Content 3</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
</tr>
<tr>
<td>Cell Content 1</td>
<td>Cell Content 2</td>
<td>Cell Content 3</td>
</tr>
<tr>
<td>More Cell Content 1</td>
<td>More Cell Content 2</td>
<td>More Cell Content 3</td>
</tr>
<tr>
<td>Even More Cell Content 1</td>
<td>Even More Cell Content 2</td>
<td>Even More Cell Content 3</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
</tr>
<tr>
<td>Cell Content 1</td>
<td>Cell Content 2</td>
<td>Cell Content 3</td>
</tr>
<tr>
<td>More Cell Content 1</td>
<td>More Cell Content 2</td>
<td>More Cell Content 3</td>
</tr>
<tr>
<td>Even More Cell Content 1</td>
<td>Even More Cell Content 2</td>
<td>Even More Cell Content 3</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
</tr>
<tr>
<td>Cell Content 1</td>
<td>Cell Content 2</td>
<td>Cell Content 3</td>
</tr>
<tr>
<td>More Cell Content 1</td>
<td>More Cell Content 2</td>
<td>More Cell Content 3</td>
</tr>
<tr>
<td>Even More Cell Content 1</td>
<td>Even More Cell Content 2</td>
<td>Even More Cell Content 3</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
</tr>
<tr>
<td>Cell Content 1</td>
<td>Cell Content 2</td>
<td>Cell Content 3</td>
</tr>
<tr>
<td>More Cell Content 1</td>
<td>More Cell Content 2</td>
<td>More Cell Content 3</td>
</tr>
<tr>
<td>Even More Cell Content 1</td>
<td>Even More Cell Content 2</td>
<td>Even More Cell Content 3</td>
</tr>
<tr>
<td>End of Cell Content 1</td>
<td>End of Cell Content 2</td>
<td>End of Cell Content 3</td>
</tr>
</tbody>
</table>
</div>
</form>
</body>
</html>
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Hello ALL,
I am creating a webpage, which has two pages.
First i login and set the sessionvariable to some value,
it will redirect me to page two.
I will logout and set the session value to null,
my problem here is when i click back in browser after logging out it is going to page two this should not happen.
please give me some idea to avoid this.
Thanks in advance
Bharath.S Ron
|
|
|
|
|
simply... check in page_load event is session variable is null or not if it is null redirect the page to login..thats all
Sarith...
|
|
|
|
|
Bharath.S.Ron wrote: I will logout and set the session value to null,
Wrong. You should call Session.Abandon()
Bharath.S.Ron wrote: my problem here is when i click back in browser after logging out it is going to page two this should not happen.
You are seeing cached version of your page by browser. In each page_load event you need to check session existence. If it's not exist, navigate user to login page. Your session check would be like this
if(Session["UserId"]==null)
{
Response.Redirect("Login.aspx");
}
|
|
|
|
|
When i click the browser back button the page load event is not triggered ,the page will be directly loaded over the browser.
Bharath.S Ron
|
|
|
|
|
Bharath.S.Ron wrote: When i click the browser back button the page load event is not triggered
Yes it won't be fired. But since you are checking Session on page load, he/she can't continue with any other operation. If they click on any button's or refresh the page, it will redirect to login page.
You can try disabling the caching too. But I doesn't looks like a good solution to me.
|
|
|
|
|
You have to check in each page load whether the session is null or not null.
If the session value is null means redirect to login page else to the required page.
VanithaVasu
|
|
|
|
|
Hi,
The real problem here is that the When he logout then the page is redirects to the Login page but,If he clicks the browser's back buttion then He can view the content of the page.
Your Idea --putting some code to page load event will not work here because it comes form the Browser's Cache memory. So it will display. Ok
Naresh Patel
|
|
|
|
|
You can disable caching on the client:
Response.CacheControl = "no-cache";
Response.AddHeader("pragma", "no-cache");
Response.Expires = -1;
Then the click on Back will cause a request to the server.
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
can you please brief me on this concept.??
Bharath.S Ron
|
|
|
|
|
Please refer to the MSDN for information about this methods.
The effect is that the Browser does not hold a copy of the page in its cache and therefore requests the page from the server when the user clicks on the back button. And you can react as you wish on the server side - show login screen or whatever you like.
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
Yes you are right, But this method will fail with firefox browser. Any other alternative do you know for firefox ?
|
|
|
|
|
It's new to me that this approach fails with Firefox
I'll have to check this because this is no good news for my applications!
Thanks for the hint.
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
I want the date format to be in this way like 15-jun-2005 using c# dot net
Regards,
Magi
|
|
|
|
|
DateformatFrom = datevalue.ToString("dd-MMM-yy hh:mm:ss");
you can convert the date into the format which ever you want.
I have shown you the one of the way to do that
Regards
Bharath.S Ron
|
|
|
|
|
get it Date format
---------------------------------------------------
|
|
|
|
|
Please do not cross post!
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
Can i write Multiple Select Statements in DataAdapter .
If it is Possible means How to write ?
I have written like this but it is throwing the error.
DataAdapter=new OleDbDataAdapter("select * from Table1;select * from Table2",connection);
VanithaVasu
|
|
|
|
|
No u canot write like this.. u can use join querry
Sarith...
|
|
|
|
|