 |
|
|
 |
|
 |
i've tried to set background image for cell based on some condition with css
style but couldn't set cssclass attribute of the cell, is there way to do this
vb code:
e.item.cells(1).cssclass = "cellimg"
style.css:
.cell
{
background-image:url(images/img.gif);
}
what i do wrong?
roopyu
|
|
|
|
 |
|
 |
Hello,
How can I do the same for Winforms?
Could you please help me?
King Regards
|
|
|
|
 |
|
 |
How We show Master record on one row and on the next row we show the detail of that master record in data grid using asp.net.
thanx
tenzeel.
|
|
|
|
 |
 | Hi  |  | Anonymous | 18:58 12 Apr '04 |
|
 |
Is there any chance of changing the widht of the columns in datagrid.
|
|
|
|
 |
|
 |
I am trying to change the orientation of the datagrid that I am using to edit data in a database from horizontal to vertical orientation. i.e. display database row data in a datagrid column. I have been able to use the edit template columns to edit data in the horizontal format but in the vertical format I am getting an the following Error Message: Type 'System.Web.UI.WebControls.TemplateColumn' does not have a property named 'asp:EditItemTemplate'.
I want to end up with the following format:
|COLUMN1 | COLUMN2 |
|Employee ID | [EditTextbox] |
|First Name | [EditTextbox] |
|Last Name | [EditTextbox] |
Instead of :
|Employee ID | First Name |Last Name |
|[EditTextbox] | [EditTextbox] |[editTextbox] |
Please help.
|
|
|
|
 |
|
 |
You forgot to show us how this method gets called. I dont understand how to trigger this method.
|
|
|
|
 |
|
 |
For the above example just do the following:
In the private void InitializeComponent()
Add:
this.DataGrid1.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.OnNWDataBound);
where DataGrid1, refers to the ID of your datagrid ... i.e. if you created a datagrid named MyGrid
, use this.MyGrid.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.OnNWDataBound);
this.OnNWDataBound <--- replace this with your own method name if you like. Whenever ItemDataBound event occurs, it will call this method.
hopes this help
-- modified at 9:13 Friday 4th November, 2005
|
|
|
|
 |
|
 |
An InvalidCastException gets thrown when I try this code on line:
DataRowView rv = (DataRowView)e.Item.DataItem;
Any ideas ?
|
|
|
|
 |
|
 |
We want to change the color of a previous cell based on the value in the current cell. For example, say we are ranking items as they are read into the datagrid. We have several columns of data we want to rank for first and second place. Once we encounter a value that is greater than the previous high value we would like to change the previous high values cell color to yellow and the new high cells color to green. For example column 1 in the following table would have 12 highlighted in green and 10 highlighted in yellow. See the following table. Column 2 would have 11 highlighted green and the two 10 highlighted yellow. and finally column 3 would have 14 green and 10 yellow.
User Name 1 2 3 Total
PLayer1 9 10 14 33
Player2 12 10 7 29
Player3 7 11 10 28
Player4 10 7 6 23
|
|
|
|
 |
|
 |
how to create scrollable datagrid with fixed header?
|
|
|
|
 |
|
 |
This could be accomlished by client side scripting and stuff. I don't think DataGrid has the capability to do.
Fixed header feature would require your own implementation of grid using table tags and stuff.
---
Softomatix
http://www.netomatix.com
|
|
|
|
 |
|
 |
Here's a simple way to accomplish this (DropDownLists scroll on top of headers though):
http://slingfive.com/demos/scrollTable/
Here's a more complex way (I have not tried, but assume it will work):
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwebteam/html/webteam11042002.asp?frame=true#Webteam11042002_topic2
Look at the 'Out for a Scroll' topic.
|
|
|
|
 |
|
 |
This css property also works for a footer row, for example a pager: .datagridheader { position:relative; top:expression(this.offsetParent.scrollTop); }
.datagridpager { position:relative; top:expression(this.offsetParent.clientHeight<this.offsetParent.scrollHeight?this.offsetParent.clientHeight-this.offsetParent.scrollHeight+this.offsetParent.scrollTop ); }
|
|
|
|
 |
|
 |
Thanks a lot for giving away the link to the "complex" way! it works great for the DataGrid and for regular html tables too...
Reynaldo Abreu
|
|
|
|
 |
|
|
 |
|
 |
In ASP.NET,, how can i get width of columns of bounded datagrid.....
|
|
|
|
 |
|
 |
Size attributes can't be obtained on server side because they are not available there. Only the client (browser) will decided what its going to do based on the HTML generated by grid control.
---
Softomatix
http://www.netomatix.com
|
|
|
|
 |
|
 |
Is there way to do other formatting other than just the cell data itself? I was able to set the alignment today when I was playing with it, but is there a way to actually format values from something like 12356 to 12,356?
|
|
|
|
 |
|
 |
Why not...
Crate your format provider and use that to format the string..
string strVal = "123456".ToString(... Here goes my IFormat provider);
item.Text = strVal;
---
Softomatix
http://www.netomatix.com
|
|
|
|
 |
|
 |
To be precise it should be ..
e.Item.Cells[4].Text = e.Item.Cells[4].Text.ToString(... use your format provider object here ...);
---
Softomatix
http://www.netomatix.com
|
|
|
|
 |
|
 |
after i sorted the column, the color stayed at the same cell eventhough the number at at cell didn't satisfy the condition???
how do we fix this??
thanks
|
|
|
|
 |
|
 |
We had no problem with color formatting with sorting or paging. If you have bound the grid right during sorting and paging it should work just fine. Here is some code that we used. In this code, we bind our gid to DataView created from DataSet.
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
BindNorthwindGrid();
}
}
private void BindNorthwindGrid()
{
ds_Northwind = new DataSet();
sqlDataAdapter1.Fill(ds_Northwind);
dv_Northwind = ds_Northwind.Tables[0].DefaultView;
if (null != m_strSortExpr &&
m_strSortExpr != String.Empty &&
m_strSortExpr.Length != 0)
{
dv_Northwind.Sort = m_strSortExpr;
}
Northwind_DataGrid.DataSource = dv_Northwind;
Northwind_DataGrid.DataBind();
}
private void OnNWGridSort(object source, System.Web.UI.WebControls.DataGridSortCommandEventArgs e)
{
m_strSortExpr = e.SortExpression;
BindNorthwindGrid();
}
---
Softomatix
http://www.pardesifashions.com/Softomatix/default.aspx
|
|
|
|
 |