473,322 Members | 1,241 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Second ItemDataBound command does not fire

When I execute the following code:

private void applicationPermissionGrid_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if (e.Item.ItemType == System.Web.UI.WebControls.ListItemType.Item ||
(e.Item.ItemType ==
System.Web.UI.WebControls.ListItemType.Alternating Item))
{
if (e.Item.Cells[6].Text == "0")
{
e.Item.Cells[0].Text = "NO";
e.Item.Cells[1].Text = "NO";
e.Item.Cells[2].Text = "NO";
e.Item.Cells[0].ForeColor = Color.Red;
e.Item.Cells[1].ForeColor = Color.Red;
e.Item.Cells[2].ForeColor = Color.Red;
}
else if (e.Item.Cells[6].Text == "1")
{
e.Item.Cells[0].Text = "YES";
e.Item.Cells[1].Text = "NO";
e.Item.Cells[2].Text = "NO";
e.Item.Cells[0].ForeColor = Color.Blue;
e.Item.Cells[1].ForeColor = Color.Red;
e.Item.Cells[2].ForeColor = Color.Red;
}

else if (e.Item.Cells[6].Text == "2")
{
e.Item.Cells[0].Text = "NO";
e.Item.Cells[1].Text = "YES";
e.Item.Cells[2].Text = "NO";
e.Item.Cells[0].ForeColor = Color.Red;
e.Item.Cells[1].ForeColor = Color.Blue;
e.Item.Cells[2].ForeColor = Color.Red;
}

else if (e.Item.Cells[6].Text == "3")
{
e.Item.Cells[0].Text = "YES";
e.Item.Cells[1].Text = "YES";
e.Item.Cells[2].Text = "NO";
e.Item.Cells[0].ForeColor = Color.Blue;
e.Item.Cells[1].ForeColor = Color.Blue;
e.Item.Cells[2].ForeColor = Color.Red;
}

else if (e.Item.Cells[6].Text == "4")
{
e.Item.Cells[0].Text = "NO";
e.Item.Cells[1].Text = "NO";
e.Item.Cells[2].Text = "YES";
e.Item.Cells[0].ForeColor = Color.Red;
e.Item.Cells[1].ForeColor = Color.Red;
e.Item.Cells[2].ForeColor = Color.Blue;
}
else if (e.Item.Cells[6].Text == "5")
{
e.Item.Cells[0].Text = "YES";
e.Item.Cells[1].Text = "NO";
e.Item.Cells[2].Text = "YES";
e.Item.Cells[0].ForeColor = Color.Blue;
e.Item.Cells[1].ForeColor = Color.Red;
e.Item.Cells[2].ForeColor = Color.Blue;
}

else if (e.Item.Cells[6].Text == "6")
{
e.Item.Cells[0].Text = "NO";
e.Item.Cells[1].Text = "YES";
e.Item.Cells[2].Text = "YES";
e.Item.Cells[0].ForeColor = Color.Red;
e.Item.Cells[1].ForeColor = Color.Blue;
e.Item.Cells[2].ForeColor = Color.Blue;
}

else if (e.Item.Cells[6].Text == "7")
{
e.Item.Cells[0].Text = "YES";
e.Item.Cells[1].Text = "YES";
e.Item.Cells[2].Text = "YES";
e.Item.Cells[0].ForeColor = Color.Blue;
e.Item.Cells[1].ForeColor = Color.Blue;
e.Item.Cells[2].ForeColor = Color.Blue;
}
}
}

private void tabPermissionGrid_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if (e.Item.ItemType == System.Web.UI.WebControls.ListItemType.Item ||
(e.Item.ItemType ==
System.Web.UI.WebControls.ListItemType.Alternating Item))
{
if (e.Item.Cells[4].Text == "8")
{
e.Item.Cells[0].Text = "YES";
e.Item.Cells[1].Text = "NO";
e.Item.Cells[0].ForeColor = Color.Blue;
e.Item.Cells[1].ForeColor = Color.Red;
}

else if (e.Item.Cells[4].Text == "16")
{
e.Item.Cells[0].Text = "NO";
e.Item.Cells[1].Text = "YES";
e.Item.Cells[0].ForeColor = Color.Red;
e.Item.Cells[1].ForeColor = Color.Blue;
}

else if (e.Item.Cells[4].Text == "24")
{
e.Item.Cells[0].Text = "YES";
e.Item.Cells[1].Text = "YES";
e.Item.Cells[0].ForeColor = Color.Blue;
e.Item.Cells[1].ForeColor = Color.Blue;
}
}
}

The ItemDataBound command for the tabPermissionGrid does not fire. The one
for the applicationPermissionGrid works fine. What could be causing the
problem?

Thanks,

Dave
Nov 16 '05 #1
2 1387
You don't show the code you use to attach the handler of the event to the
procedure. Everything you show here is not useful to solving your problem.

Note: You use this code if(e.Item.Cells[6].Text == "X") a lot. It would
improve readablilty to use a select case statement.

Chris

"kscdavefl" <ks*******@discussions.microsoft.com> wrote in message
news:82**********************************@microsof t.com...
When I execute the following code:

private void applicationPermissionGrid_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if (e.Item.ItemType == System.Web.UI.WebControls.ListItemType.Item ||
(e.Item.ItemType ==
System.Web.UI.WebControls.ListItemType.Alternating Item))
{
if (e.Item.Cells[6].Text == "0")
{
e.Item.Cells[0].Text = "NO";
e.Item.Cells[1].Text = "NO";
e.Item.Cells[2].Text = "NO";
e.Item.Cells[0].ForeColor = Color.Red;
e.Item.Cells[1].ForeColor = Color.Red;
e.Item.Cells[2].ForeColor = Color.Red;
}
else if (e.Item.Cells[6].Text == "1")
{
e.Item.Cells[0].Text = "YES";
e.Item.Cells[1].Text = "NO";
e.Item.Cells[2].Text = "NO";
e.Item.Cells[0].ForeColor = Color.Blue;
e.Item.Cells[1].ForeColor = Color.Red;
e.Item.Cells[2].ForeColor = Color.Red;
}

else if (e.Item.Cells[6].Text == "2")
{
e.Item.Cells[0].Text = "NO";
e.Item.Cells[1].Text = "YES";
e.Item.Cells[2].Text = "NO";
e.Item.Cells[0].ForeColor = Color.Red;
e.Item.Cells[1].ForeColor = Color.Blue;
e.Item.Cells[2].ForeColor = Color.Red;
}

else if (e.Item.Cells[6].Text == "3")
{
e.Item.Cells[0].Text = "YES";
e.Item.Cells[1].Text = "YES";
e.Item.Cells[2].Text = "NO";
e.Item.Cells[0].ForeColor = Color.Blue;
e.Item.Cells[1].ForeColor = Color.Blue;
e.Item.Cells[2].ForeColor = Color.Red;
}

else if (e.Item.Cells[6].Text == "4")
{
e.Item.Cells[0].Text = "NO";
e.Item.Cells[1].Text = "NO";
e.Item.Cells[2].Text = "YES";
e.Item.Cells[0].ForeColor = Color.Red;
e.Item.Cells[1].ForeColor = Color.Red;
e.Item.Cells[2].ForeColor = Color.Blue;
}
else if (e.Item.Cells[6].Text == "5")
{
e.Item.Cells[0].Text = "YES";
e.Item.Cells[1].Text = "NO";
e.Item.Cells[2].Text = "YES";
e.Item.Cells[0].ForeColor = Color.Blue;
e.Item.Cells[1].ForeColor = Color.Red;
e.Item.Cells[2].ForeColor = Color.Blue;
}

else if (e.Item.Cells[6].Text == "6")
{
e.Item.Cells[0].Text = "NO";
e.Item.Cells[1].Text = "YES";
e.Item.Cells[2].Text = "YES";
e.Item.Cells[0].ForeColor = Color.Red;
e.Item.Cells[1].ForeColor = Color.Blue;
e.Item.Cells[2].ForeColor = Color.Blue;
}

else if (e.Item.Cells[6].Text == "7")
{
e.Item.Cells[0].Text = "YES";
e.Item.Cells[1].Text = "YES";
e.Item.Cells[2].Text = "YES";
e.Item.Cells[0].ForeColor = Color.Blue;
e.Item.Cells[1].ForeColor = Color.Blue;
e.Item.Cells[2].ForeColor = Color.Blue;
}
}
}

private void tabPermissionGrid_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if (e.Item.ItemType == System.Web.UI.WebControls.ListItemType.Item ||
(e.Item.ItemType ==
System.Web.UI.WebControls.ListItemType.Alternating Item))
{
if (e.Item.Cells[4].Text == "8")
{
e.Item.Cells[0].Text = "YES";
e.Item.Cells[1].Text = "NO";
e.Item.Cells[0].ForeColor = Color.Blue;
e.Item.Cells[1].ForeColor = Color.Red;
}

else if (e.Item.Cells[4].Text == "16")
{
e.Item.Cells[0].Text = "NO";
e.Item.Cells[1].Text = "YES";
e.Item.Cells[0].ForeColor = Color.Red;
e.Item.Cells[1].ForeColor = Color.Blue;
}

else if (e.Item.Cells[4].Text == "24")
{
e.Item.Cells[0].Text = "YES";
e.Item.Cells[1].Text = "YES";
e.Item.Cells[0].ForeColor = Color.Blue;
e.Item.Cells[1].ForeColor = Color.Blue;
}
}
}

The ItemDataBound command for the tabPermissionGrid does not fire. The
one
for the applicationPermissionGrid works fine. What could be causing the
problem?

Thanks,

Dave

Nov 16 '05 #2


"Chris, Master of All Things Insignifican" wrote:
You don't show the code you use to attach the handler of the event to the
procedure. Everything you show here is not useful to solving your problem.

Note: You use this code if(e.Item.Cells[6].Text == "X") a lot. It would
improve readablilty to use a select case statement.

Chris

"kscdavefl" <ks*******@discussions.microsoft.com> wrote in message
news:82**********************************@microsof t.com...
When I execute the following code:

private void applicationPermissionGrid_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if (e.Item.ItemType == System.Web.UI.WebControls.ListItemType.Item ||
(e.Item.ItemType ==
System.Web.UI.WebControls.ListItemType.Alternating Item))
{
if (e.Item.Cells[6].Text == "0")
{
e.Item.Cells[0].Text = "NO";
e.Item.Cells[1].Text = "NO";
e.Item.Cells[2].Text = "NO";
e.Item.Cells[0].ForeColor = Color.Red;
e.Item.Cells[1].ForeColor = Color.Red;
e.Item.Cells[2].ForeColor = Color.Red;
}
else if (e.Item.Cells[6].Text == "1")
{
e.Item.Cells[0].Text = "YES";
e.Item.Cells[1].Text = "NO";
e.Item.Cells[2].Text = "NO";
e.Item.Cells[0].ForeColor = Color.Blue;
e.Item.Cells[1].ForeColor = Color.Red;
e.Item.Cells[2].ForeColor = Color.Red;
}

else if (e.Item.Cells[6].Text == "2")
{
e.Item.Cells[0].Text = "NO";
e.Item.Cells[1].Text = "YES";
e.Item.Cells[2].Text = "NO";
e.Item.Cells[0].ForeColor = Color.Red;
e.Item.Cells[1].ForeColor = Color.Blue;
e.Item.Cells[2].ForeColor = Color.Red;
}

else if (e.Item.Cells[6].Text == "3")
{
e.Item.Cells[0].Text = "YES";
e.Item.Cells[1].Text = "YES";
e.Item.Cells[2].Text = "NO";
e.Item.Cells[0].ForeColor = Color.Blue;
e.Item.Cells[1].ForeColor = Color.Blue;
e.Item.Cells[2].ForeColor = Color.Red;
}

else if (e.Item.Cells[6].Text == "4")
{
e.Item.Cells[0].Text = "NO";
e.Item.Cells[1].Text = "NO";
e.Item.Cells[2].Text = "YES";
e.Item.Cells[0].ForeColor = Color.Red;
e.Item.Cells[1].ForeColor = Color.Red;
e.Item.Cells[2].ForeColor = Color.Blue;
}
else if (e.Item.Cells[6].Text == "5")
{
e.Item.Cells[0].Text = "YES";
e.Item.Cells[1].Text = "NO";
e.Item.Cells[2].Text = "YES";
e.Item.Cells[0].ForeColor = Color.Blue;
e.Item.Cells[1].ForeColor = Color.Red;
e.Item.Cells[2].ForeColor = Color.Blue;
}

else if (e.Item.Cells[6].Text == "6")
{
e.Item.Cells[0].Text = "NO";
e.Item.Cells[1].Text = "YES";
e.Item.Cells[2].Text = "YES";
e.Item.Cells[0].ForeColor = Color.Red;
e.Item.Cells[1].ForeColor = Color.Blue;
e.Item.Cells[2].ForeColor = Color.Blue;
}

else if (e.Item.Cells[6].Text == "7")
{
e.Item.Cells[0].Text = "YES";
e.Item.Cells[1].Text = "YES";
e.Item.Cells[2].Text = "YES";
e.Item.Cells[0].ForeColor = Color.Blue;
e.Item.Cells[1].ForeColor = Color.Blue;
e.Item.Cells[2].ForeColor = Color.Blue;
}
}
}

private void tabPermissionGrid_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if (e.Item.ItemType == System.Web.UI.WebControls.ListItemType.Item ||
(e.Item.ItemType ==
System.Web.UI.WebControls.ListItemType.Alternating Item))
{
if (e.Item.Cells[4].Text == "8")
{
e.Item.Cells[0].Text = "YES";
e.Item.Cells[1].Text = "NO";
e.Item.Cells[0].ForeColor = Color.Blue;
e.Item.Cells[1].ForeColor = Color.Red;
}

else if (e.Item.Cells[4].Text == "16")
{
e.Item.Cells[0].Text = "NO";
e.Item.Cells[1].Text = "YES";
e.Item.Cells[0].ForeColor = Color.Red;
e.Item.Cells[1].ForeColor = Color.Blue;
}

else if (e.Item.Cells[4].Text == "24")
{
e.Item.Cells[0].Text = "YES";
e.Item.Cells[1].Text = "YES";
e.Item.Cells[0].ForeColor = Color.Blue;
e.Item.Cells[1].ForeColor = Color.Blue;
}
}
}

The ItemDataBound command for the tabPermissionGrid does not fire. The
one
for the applicationPermissionGrid works fine. What could be causing the
problem?

Thanks,

Dave


The applicationPermissionGrid_ItemdataBoundCommand event fires when the grid is first loadded. However, the tabPermissionGrid loads but does not recognize the ItemdataBound command at all.

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: deko | last post by:
I have a several forms that accept user input in a textbox and then take some action based on that input after a command button is clicked. Is it possible issue the command when the user presses...
0
by: James G. Beldock | last post by:
Has anyone else had the following problem: place a DataGrid within an ASP.Net table cell and suddenly none of the ItemDataBound events seem to fire. Move it back out and they fire just fine.... ...
1
by: Dirk Meusel | last post by:
Background: On my webform a simple datalist shows one column. The databind is done in the page_load event. In the ItemTemplate a linkbutton serves for providing the Select Command. Problem:...
2
by: Peter Afonin | last post by:
Hello: I'm deleteing data using Datagrid, then rebind it. For some reason ItemDataBound event doesn't fire after DeleteCommand. Why is this? Is it by design, or I'm missing something? I have...
8
by: Donald Xie | last post by:
Hi, I noticed an interesting effect when working with controls that are dynamically loaded. For instance, on a web form with a PlaceHolder control named ImageHolder, I dynamically add an image...
1
by: Gabriël | last post by:
Hi All, I've created an eventhandler for ItemdataBound and ItemCreated, but when I access "e.Item.Cells.Text" it's always empty. BUT, when I assign a value to this empty field (while being in...
4
by: Girish | last post by:
Im trying to create a grid within a grid programmatically. Ive been successful in doing this but I need the embedded grid to fire its ItemDataBound event so I can handle it. The event does not seem...
14
by: Kevin | last post by:
A couple of easy questions here hopefully. I've been working on two different database projects which make use of multiple forms. 1. Where's the best/recommended placement for command buttons...
1
by: greenb | last post by:
I'm using the ItemDataBound event of the DataGrid to highlight cells that are outside an acceptable range. Each row has a button column (CommandName='Select'), that is used to display addtional...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.