Thank you, Peter, that gets me sometimes...
Now I am getting a
Compilation Error
Description: An error occurred during the compilation of a resource
required
to service this request. Please review the following specific error
details
and modify your source code appropriately.
Compiler Error Message: CS0122: 'SalesApp.subscriptions.Item_Bound(object,
System.Web.UI.WebControls.DataGridItemEventArgs)' is inaccessible due to
its
protection level
and the highlighted line is line 14
Source Error:
Line 12: <form id="Form1" method="post" runat="server">
Line 13: <IMG style="Z-INDEX: 100; LEFT: 8px; POSITION: absolute; TOP:
8px" src="Images/logo.gif">
Line 14: <asp
ataGrid id="dgSubs" style="Z-INDEX: 102; LEFT: 24px;
POSITION: absolute; TOP: 128px" runat="server"
OnItemDataBound="Item_Bound"
Line 15: BorderColor="#CCCCCC" BorderStyle="Ridge" BorderWidth="1px"
BackColor="White" CellPadding="0"
Line 16: AllowPaging="True" Font-Size="Smaller" CellSpacing="2"
Width="1000px" HorizontalAlign="Center">
Peter Bromberg said:
Antonio,
Whenever you see this exception you must remember to ask yourself,
"Should I be using one equals sign or two?".
if (e.Item.Cells[4].Text = "Null/No Set Dummy Row")
-- the above is not a test for equality. It is an attempt to ASSIGN
"Nul...." to the .Text property within an if( ... ) statement. I think
you
want a test for equality
"==" here.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
Antonio said:
Hi, Peter,
Thanks for replying.
I have this code in the Item_Bound method and I get a "Cannot
implicitly
convert type 'string' to 'bool'
if (e.Item.Cells[4].Text = "Null/No Set Dummy Row")
e.Item.Cells[4].Text = "None";
Am I missing something?
Thank,
Antonio
message
Antonio,
the ItemDataBound event fires as each row of your DataGrid is bound.
You
can
gain access to each cell, its contents (including any controls within
the
cell) in this eventhandler and make any modifications you want. See
MSDN
documentation for syntax and code examples.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
:
Hello, everyone.
Is there a way to not display a certain value in a datagrid cell?
I have a datagrid for subscriptions and ebooks and if there isn't an
e-book
listed, the value from the database (SQL) is "Null/No Set Dummy
Row".
Is there a way I can suppress that data in the datagrid?
Thanks,
Antonio