how to bind repeater control as message threading - asp.net-2.0

i have crm application. i have one difficulties that how i bind repeater control as message threading. like first thread as question and second thread as answer of that question. if user asked multiple question then first,second,.. threads as question and.as it is like message chatting...
for keeping data from database i use this stored procedure:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[ViewMessageThreads] (#inquiry_id varchar(50))
AS
BEGIN
SET NOCOUNT ON;
select
i.body as master_body,
h.body as history_body,
q.body as question_body,
q.Created_date as question_timestamp,
a.body as answer_body,
a.Created_date as answer_timestamp,
t.Type_name as user_type
from tbl_Inquiry_History i
left join tbl_Inquiry_master h on h.Inquiry_id=i.Inquiry_id
left join tbl_Question q on q.Inquiry_id=i.Inquiry_id
left join tbl_Answer a on a.Question_id=q.Inquiry_id
left join tbl_User_master u on u.Id=i.User_id
left join tbl_Login_master l on l.Id=u.User_id
left join tbl_Type t on t.Id = l.type_id
where (i.Inquiry_id=#inquiry_id)
END
and this gives me result as:
master_body history_body question_body question_t.. answer_body answer_t.. user_type
__________________________________________________________________________________________
question 1 NULL question 1 2005-03-14... NULL NULL User
question 1 NULL question 2 2005-03-14... NULL NULL User
and i include this design source of repeater:
<asp:Repeater ID="Repeater_Inquiry_Messages" runat="server">
<ItemTemplate>
<table id="ctl00_ContentPlaceHolder1_dl_ticketmsg" cellspacing="0" border="0" style="width:100%;border-collapse:collapse;">
<tbody><tr>
<td style="background-color:#F5F5FF;">
<table cellpadding="0" cellspacing="0" border="0">
<tbody><tr>
<td class="header">
<span id="ctl00_ContentPlaceHolder1_dl_ticketmsg_ctl00_lbl_msg_no"><%#Container.ItemIndex+1 %></span></td>
<td class="normaltext" valign="bottom">
<span id="ctl00_ContentPlaceHolder1_dl_ticketmsg_ctl00_lbl_tagline">Message By <b><asp:Label ID="lbl_user_t" runat="server" Text='<%#Eval("user_type")%>'/></b> on <asp:Label ID="lbldatetime" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "question_timestamp","{0:ddd, dd MMMM yyyy}")%>'/></span></td>
</tr>
<tr>
<td class="header">
</td>
<td class="normaltext" valign="bottom">
<b>Message :</b><br>
<span id="ctl00_ContentPlaceHolder1_dl_ticketmsg_ctl00_Label1"><asp:Label ID="lbl_inquiry_desc" runat="server" Text='<%#Eval("question_body")%>'/></span></td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</ItemTemplate>
<SeparatorTemplate>
<table>
<tr>
<td style="height:3px"></td>
</tr>
</table>
</SeparatorTemplate>
<ItemTemplate>
<table id="ctl00_ContentPlaceHolder1_dl_ticketmsg1" cellspacing="0" border="0" style="width:100%;border-collapse:collapse;">
<tbody><tr>
<td style="background-color:#F5F5FF;">
<table cellpadding="0" cellspacing="0" border="0">
<tbody><tr>
<td class="header">
<span id="ctl00_ContentPlaceHolder1_dl_ticketmsg1_ctl00_lbl_msg_no"><%#Container.ItemIndex+1 %></span></td>
<td class="normaltext" valign="bottom">
<span id="ctl00_ContentPlaceHolder1_dl_ticketmsg1_ctl00_lbl_tagline">Message By <b><asp:Label ID="Label1" runat="server" Text='<%#Eval("user_type")%>'/></b> on <asp:Label ID="Label2" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "answer_timestamp","{0:ddd, dd MMMM yyyy}")%>'/></span></td>
</tr>
<tr>
<td class="header">
</td>
<td class="normaltext" valign="bottom">
<b>Message :</b><br>
<span id="ctl00_ContentPlaceHolder1_dl_ticketmsg1_ctl00_Label1"><asp:Label ID="Label3" runat="server" Text='<%#Eval("answer_body")%>'/></span></td>
</tr>
<tr>
<td class="header">
</td>
<td class="normaltext" valign="bottom">
<b></b>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</ItemTemplate>
</asp:Repeater>
how ever this gives me only question thread while i commenting up this second message thread.
----------------------------------------Updated---------------------------------------
please help me..
---------------------------------------Updated----------------------------------------
Server Error in '/OmInvestmentStockMarketing_new' Application.
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: CS1026: ) expected
Source Error:
Line 162: <span id="ctl00_ContentPlaceHolder1_dl_ticketmsg_ctl00_lbl_msg_no"><%#Container.ItemIndex+1 %></span></td>
Line 163: <td class="normaltext" valign="bottom">
Line 164: <span id="ctl00_ContentPlaceHolder1_dl_ticketmsg_ctl00_lbl_tagline">Message By <b><asp:Label ID="lbl_user_t" runat="server" Text='<%# If(Eval("cargo2").ToString() Is "Admin", "You", Eval("cargo2"))%>'/></b>
Line 165: on <asp:Label ID="lbldatetime" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"cargo1","{0:ddd, dd MMMM yyyy}")%>'/></span></td>
Line 166: </tr>
Source File: c:\Documents and Settings\Vishal\My Documents\Visual Studio 2005\WebSites\OmInvestmentStockMarketing_new\Admin\OWM_Inquiry.aspx Line: 164
Show Detailed Compiler Output:
Show Complete Compilation Source:
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053
---------------------------Updated-------------------------------------------
<asp:Repeater ID="Repeater_Inquiry_Messages" runat="server">
<ItemTemplate>
<div style='display: <%# Container.ItemIndex == 0 ? "none" : "block" %>'>
<table id="ctl00_ContentPlaceHolder1_dl_ticketmsg" cellspacing="0" border="0" style="width:100%;border-collapse:collapse;">
<tbody><tr>
<td style="background-color:#F5F5FF;">
<table cellpadding="0" cellspacing="0" border="0">
<tbody><tr>
<td class="header">
<span id="ctl00_ContentPlaceHolder1_dl_ticketmsg_ctl00_lbl_msg_no"><%--<%#Container.ItemIndex+1 %>--%><%# Container.ItemIndex.ToString() == "0" ? int.Parse("1") : Container.ItemIndex %></span></td>
<td class="normaltext" valign="bottom">
<span id="ctl00_ContentPlaceHolder1_dl_ticketmsg_ctl00_lbl_tagline">Message By <b><asp:Label ID="lbl_user_t" runat="server" Text='<%# Eval("cargo2").ToString()=="Admin" ? "You" : Eval("cargo2") %>'></asp:Label></b>
on <asp:Label ID="lbldatetime" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"cargo1","{0:ddd, dd MMMM yyyy}")%>'/></span></td>
</tr>
<tr>
<td class="header">
</td>
<td class="normaltext" valign="bottom">
<b>Message :</b><br>
<span id="ctl00_ContentPlaceHolder1_dl_ticketmsg_ctl00_Label1"><asp:Label ID="lbl_inquiry_desc" runat="server" Text='<%#Eval("body")%>'/></span></td>
</tr>
<tr>
<td class="header">
</td>
<td class="normaltext" valign="bottom">
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</div>
</ItemTemplate>
<SeparatorTemplate>
<table>
<tr>
<td style="background-color:White;width:5px;">
<span id="Label2"></span>
</td></tr>
</table>
</SeparatorTemplate>
</asp:Repeater>

I'm going to go back to my schema (related question) - purely because it's quicker for me than trying to reproduce yours with data, etc. but hopefully this will help (You'll just have to map it back onto your structures). This answer may get heavily down voted - as it does not answer the question posed - but suggests a way to avoid the complex binding that would be required (having now seen how the output of the stored procedure is going to be used).
If your schema was like this:-
create table tbl_Inquiry_master (
id int,
body varchar(1024)
);
create table tbl_Inquiry_history (
id int,
inquiry_id int,
body varchar(1024)
);
create table tbl_question (
id int,
inquiry_id int,
body varchar(1024)
);
create table tbl_answer (
id int,
question_id int,
body varchar(1024)
);
insert into tbl_Inquiry_master values (1, 'inquiry one');
insert into tbl_Inquiry_master values (2, 'inquiry two');
insert into tbl_Inquiry_master values (3, 'inquiry three');
insert into tbl_Inquiry_master values (4, 'inquiry four');
insert into tbl_Inquiry_history values (1, 1,'history 1 (relates to inquiry 1)');
insert into tbl_Inquiry_history values (2, 3,'history 2 (relates to inquiry 3)');
insert into tbl_question values (1,1,'inquiry one question one')
insert into tbl_question values (2,1,'inquiry one question two')
insert into tbl_question values (3,2,'inquiry two question one')
insert into tbl_question values (4,4,'inquiry four question one')
insert into tbl_answer values (1,1,'answer 1 to question 1')
insert into tbl_answer values (2,1,'answer 2 to question 1')
insert into tbl_answer values (3,2,'answer 1 to question 2')
insert into tbl_answer values (4,4,'answer 1 to question 4')
insert into tbl_answer values (5,4,'answer 2 to question 4')
insert into tbl_answer values (6,4,'answer 3 to question 4')
You could have a stored procedure like this:-
create procedure [dbo].[ViewMessageThreads] (
#inquiry_id int)
AS
BEGIN
create table #return (
FromTable varchar(10),
sort1 int,
sort2 int,
sort3 int,
body varchar(1024),
cargo1 datetime,
cargo2 varchar(50)
)
insert into #return
select 'master', 1, 0, 0, m.body , null, null
from tbl_Inquiry_master m
where m.id=#inquiry_id
insert into #return
select 'history', 2, 0, 0, h.body , null, null
from tbl_Inquiry_history h
where h.inquiry_id=#inquiry_id
insert into #return
select 'question', 3, q.id, 0, q.body , GETDATE(), 'user'
from tbl_question q
where q.inquiry_id=#inquiry_id
insert into #return
select 'answer', 3, q.id, a.id, a.body , GETDATE(), 'staff'
from tbl_answer a
join tbl_question q on q.id=a.question_id
where q.inquiry_id=#inquiry_id
/*
-- uncomment this block to update the type in the way you appear
-- to want it set, I'm leaving it commented in my answer as I
-- cannot confirm the logic works - as I don't have your schema/data
-- and the code is, therefore, untested.
-- this logic could be moved to the top of the SP and the variable could be
-- substituted into each SELECT, so that the UPDATE would then not be required
declare #Type_name = #varchar(50) -- I don't know the dimensions of this type
select top 1 #Type_name=t.Type_name
from tbl_Type t
join tbl_Login_master l on l.Id=t.Id
join tbl_User_master u on u.Id=l.Id
join tbl_Inquiry_History h on h.User_id=u.Id
where (h.Inquiry_id=#inquiry_id))
update #return set cargo2=#Type_name
*/
select *
from #return
order by sort1, sort2, sort3
end
and calling it like:-
exec [dbo].[ViewMessageThreads] 1
exec [dbo].[ViewMessageThreads] 2
exec [dbo].[ViewMessageThreads] 3
exec [dbo].[ViewMessageThreads] 4
which would produce:-
which would produce output that should be easier for you to bind onto, rather than that output by the SP in your question.
You can use the values in the fromtable and sort columns to make decisions in your repeater about how to format the other columns.
You'll have to play around with populating the cargo slots (you may need more) and the sort order - as I'm not sure where/whether you want any output from the History/Master tables. Hopefully this will head you in the right direction.

Related

Horizontally tile tables in listview?

I have records from database separated by department, I want to tile them horizontally inside different tables (for each department). Here is what I tried (This does not work)
Aspx
<asp:ListView ID="lvUnderwriting" GroupItemCount="6" runat="server" GroupPlaceholderID="grpPlaceHolder1" ItemPlaceholderID="itemPlaceHolder1">
<LayoutTemplate>
<table>
<asp:PlaceHolder ID="grpPlaceHolder1" runat="server" ></asp:PlaceHolder>
</table>
</LayoutTemplate>
<GroupTemplate>
<span><b><%# Eval("gensubbusiclass") %></b></span>
<table>
<tr>
<th>Role Name:</th>
<th>Pending Tasks:</th>
<th>On Leave:</th>
</tr>
<tr>
<asp:PlaceHolder ID="itemPlaceHolder1" runat="server"></asp:PlaceHolder>
</tr>
</table>
</GroupTemplate>
<ItemTemplate>
<tr>
<td><span> <%#Eval("RoleName") %></span></td>
<td><span><%# Eval("Count") %></span></td>
<td><span><%# Eval("OnLeave") %></span></td>
</tr>
</ItemTemplate>
</asp:ListView>
Database rows
My current results. For some reason the second department is divided into two tables. Also how do I tile them horizontally?
Okay what I got was that ListView cannot display master detail records out of the box. Here is what I tried to get it working for me. The trick was to dynamically add a new row to the table if the header databound item was changed, the database records need to be sorted in advance to get this working. Referenced from here using Asp.net 3.5 ListView 4 Guys from Rolla
Aspx
<asp:ListView ID="lvUnderwriting" runat="server" ItemPlaceholderID="itemPlaceHolder1">
<LayoutTemplate>
<table border="1" cellpadding="4px">
<tr>
<th>Role Name:</th>
<th>Assigned:</th>
<th>On Leave:</th>
</tr>
<tr>
<asp:PlaceHolder ID="itemPlaceHolder1" runat="server" />
</tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<%# AddGroupUnderwriting() %>
<td><%# Eval("RoleName") %></td>
<td><%# Eval("Count") %></td>
<td><%# Eval("OnLeave") %></td>
</tr>
</ItemTemplate>
</asp:ListView>
C#
// Add group row to underwriting grid
private string prevUWBusinessClass = "";
public string AddGroupUnderwriting()
{
string currentUWBusinessClass = Eval("gensubbusiclass").ToString();
if (currentUWBusinessClass != prevUWBusinessClass)
{
prevUWBusinessClass = currentUWBusinessClass;
return string.Format(#"<tr><td colspan=""3""><h3>Department: {0}</h3></td></tr>", currentUWBusinessClass);
}
else
return "";
}

Hide tr or td in a table using vb.net in codebehind

In my masterpage I have links for users also the authorization is different like admin and regular user.
links under each other and I can hide the hyperlinks depending on authorization status but the problem is i.e when I have 3 links the second link for the admin the link will hide when the user is regular and the link place empty like 123 1 3.
So I have an idea using table each link in one tr but I can`t hide td or tr because Visible is not in properties.
any help?
thank you
According to how to hide a having asp.net control:
you can give ID either to the TD or TR to which you want to hide/show
with the runat="server" and also you can take that tr/td inside the
div tag and give id to that div tag and also runat=server attribute
and after that you can pro grammatically hide/show that div.
like
<pre>
<tr id="trhide" runat="server"> </tr>
</pre>
in code behind write
trhide.visible=true/false
In the master page VB code behind add a public procedure: Then call the public set from your aspx page.
'======================================================================================================
'Set Tab No invisible
'======================================================================================================
Public Sub setTabNumberLabel(visible As Int16)
If visible = 0 Then
td_page.Visible = False
Else
td_page.Visible = True
End If
End Sub
The master aspx would be:
<table style="width:100%">
<!--<tr style="background-color:#565656;">-->
<tr>
<td style="width:15%;text-align:left;vertical-align:bottom;padding-left:20px;">Stategic Energy Assessment ( <asp:Label ID="lbl_year_ended" runat="server" /> )</td>
<td style="text-align:center;vertical-align:bottom;"><asp:Label ID="lbl_utility_name_and_id" runat="server" /></td>
<td id="td_page" runat="server" style="width:15%;text-align:right;vertical-align:bottom;padding-right:20px;">Tab No: <asp:Label ID="lbl_page" runat="server" /></td>
</tr>
<tr><td colspan="3" style="vertical-align:central"><hr /></td></tr>
<tr>
<td style="width:15%;text-align:left;vertical-align:central">
<asp:Label ID="lbl_print_version" runat="server" Text="View Printable Vision" Visible="false" />
</td>
<td style="font-size:larger; font-weight:bold; text-align:center; text-transform:capitalize;vertical-align:central">
<asp:Label ID="lbl_schedule_name" runat="server" />
</td>
<td style="width:15%;text-align:right;vertical-align:central;padding-right:20px;">
<asp:LinkButton ID="btn_footnotes" runat="server" Visible="false">Footnotes</asp:LinkButton>
</td>
</tr>
<%--<tr><td colspan="3" style="vertical-align:central" class="auto-style1"></td></tr>--%>
<tr><td colspan="3" style="vertical-align:central; padding-right:20%;padding-left:20%; ">
<i><asp:Label ID="lbl_headnotes" runat="server" Text="" /></i></td></tr>
<tr><td colspan="3" style="vertical-align:central"><hr /></td></tr>
</table>
The other answer is correct and works fine. Just adding complete piece of code.
It's quite amusing that you don't need to add runat=server for a table but you can still hide tr for that table using runat attribute.
<table>
<tr>
<td>aa</td><td>bb</td>
</tr>
<tr id="trHide1" runat="server">
<td>aa</td><td>bb</td>
</tr>
<tr id="trHide2" runat="server">
<td>aa</td><td>bb</td>
</tr>
<tr>
<td>aa</td><td>bb</td>
</tr>
</table>
Now just set properties in codebehind (hiding the tr)
trHide1.Visible = false;
trHide2.Visible = false;

How to add blank row in grid view?

I am new to the ASP.NET i am binding one list of data object to the grid view. I want to display blank row after each record in grid view so i have done this by as below in code behind
List<DatabaseDTO> lstdatabase= new List<DatabaseDTO>();
foreach(int jobNumber in JobnumberList)
{
DatabaseDTO dataObject = new DatabaseDTO();
dataobject = GetDatabaseData(jobNumber);//Method to retrieve data and return data object
lstdatabase.Add(dataObject);
lstdatabase.Add(new DatabaseDTO());
}
gridView.DataSource = lstdatabase;
gridView.DataBind();
it's working correct i am getting the desired blank row in the grid view but i know this is not right way because i am adding object to the list so i can add the blank row in place of that i would very much like to adjust this blank row from the aspx page. I know there is another way using the DataTable but it is also not very good because it also adds the unnecessary records to the DataTable. So any other work around or way to solve this would be very great. Thank you.
Try This
<div>
<asp:DataList ID="DataList1" runat="server">
<ItemStyle ForeColor="#4A3C8C" BackColor="#E7E7FF"></ItemStyle>
<HeaderTemplate>
<table width="900px">
<tr>
<td width="300px">
<b>Name</b>
</td>
<td width="300px">
<b>Account No</b>
</td>
<td width="300px">
<b>Company</b>
</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table width="900px">
<tr>
<td align="left" width="300px">
<%# DataBinder.Eval(Container.DataItem, "Name")%>
</td>
<td align="left" width="300px">
<%# DataBinder.Eval(Container.DataItem, "AccountNo")%>
</td>
<td align="left" width="300px">
<%# DataBinder.Eval(Container.DataItem, "Company")%>
</td>
</tr>
<tr>
<td align="left" width="300px">
<br />
</td>
<td align="left" width="300px">
<br />
</td>
<td align="left" width="300px">
<br />
</td>
</tr>
</table>
</ItemTemplate>
<HeaderStyle Font-Bold="True" ForeColor="#F7F7F7" BackColor="#4A3C8C"></HeaderStyle>
<SeparatorTemplate><br /></SeparatorTemplate>
</asp:DataList>
</div>
You can't have an empty row in the Datagrid if it isn't present in the data source. You have to think that after all the grid data is just a representation of your data source, if there is a empty row, the grid will show it, if there is not, it wont.
Write a stored procedure to get Output Parameter from sql server and bind to grid view if record is not there..

display and hide particular column in repeater?

I have a repeater. And i want to hide and display a particular column for a particular condition. I have three types of subjects and their ids are 0,1,2 respectively. Now i want to show that particular column when the subject will be 2 only..
My code is :-
<table id="table1" class="yui" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th>
EmpID #
</th>
<th>Edit</th>
</tr>
</thead>
<tbody>
<asp:Repeater ID="Repaddressorbbl" runat="server" OnItemCommand="Repaddressorbbl_ItemCommand">
<ItemTemplate>
<tr id="gh" style="cursor: pointer" onclick="Select(this);">
<td style="text-align: center;">
<%#Eval("empid")%>
</td>
<td>
<asp:LinkButton ID="lknumber" runat="server" Text="Edit" CommandName="subjectid" />
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</tbody>
<tfoot>
</tfoot>
</table>
You could catch the OnItemDataBound event of the repeater and hide the column there if the (subject) item id is 2.
In order you can get a reference to the column, make it a server control:
<td style="text-align: center;" id="COL_TO_HIDE" runat="server"><%#Eval("empid")%></td>
Then in the repeater event you can simply look for the control and hide it:
protected void YourRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
var subject = (Subject)e.Item.DataItem;
if (subject.Id == 2)
{
var col = e.Item.FindControl("COL_TO_HIDE");
col.Visible = false;
}
}
}
Please note, this is just a simplified example which should you get started.
I think you should start by using <HeaderTemplate></HeaderTemplate> and <FooterTemplate></FooterTemplate> to define the start and end of your table just to tidy it up.
You can get the table to run on the server by adding a runat="server" and give the column <td> an id and a runat="server" attribute so you can program server code against it. I'd then eval bind the visible attribute of the cell based on your field value or use attributes.add("display:none") or just use a grid view as suggested in the link.
<asp:Repeater ID="Repaddressorbbl" runat="server"
OnItemCommand="Repaddressorbbl_ItemCommand">
<ItemTemplate>
<tr id="gh" style="cursor: pointer" onclick="Select(this);">
<td style="text-align: center;">
<%#Eval("empid")%>
</td>
<% if (false){ %>
<td>
<asp:LinkButton ID="lknumber" runat="server"
Text="Edit" CommandName="subjectid" />
</td>
<% } %>
</tr>
</ItemTemplate>
</asp:Repeater>

"Code blocks are not supported in this context" error in ASP.NET

I am getting this error by simply trying to insert some VB.NET code in ASP.NET markup. See the code:
<%# Control Inherits="PerformanceWeb.Framework.SiteSettings" CodeBehind="sitesettings.ascx.vb" language="vb" AutoEventWireup="false" %>
<table id="TABLE1" cellSpacing="0" cellPadding="2" border="0" runat="server">
<% If EditDowntimeMode Then%>
<tr><td class="Normal"><asp:label id="lblDowntimeLegacyMode" Runat="server">lblDowntimeLegacyMode</asp:label></td></tr>
<tr>
<td class="DowntimeLegacyModeIndented" width="130">
<asp:label id="lblLegacyMode" Runat="server">lblLegacyMode</asp:label>
</td>
<td class="Normal" colSpan="2">
<asp:RadioButton id="rdoLegacyMode" GroupName="DowntimeLegacyMode" Runat="server"></asp:RadioButton>
</td>
</tr>
<tr>
<td class="DowntimeLegacyModeIndented" width="130">
<asp:label id="lblNewCauses" Runat="server">lblNewCauses</asp:label>
</td>
<td class="Normal" colSpan="2">
<asp:RadioButton id="rdoNewCauses" GroupName="DowntimeLegacyMode" Runat="server"></asp:RadioButton>
</td>
</tr>
<tr>
<td colspan="2"><hr /></td>
</tr>
<% End if%>
</table>
Codebehind
#Region "Properties"
Public Property EditDowntimeMode() As Boolean
Get
Return m_EditDowntimeMode
End Get
Set(ByVal value As Boolean)
m_EditDowntimeMode = value
End Set
End Property
#End Region
When you add a runat='server' to an HTML control you change the rendering and code blocks aren't supported inside.
Changed from:
<table id="TABLE1" cellSpacing="0" cellPadding="2" border="0" runat="server">
to:
<table id="TABLE1" cellSpacing="0" cellPadding="2" border="0">
In the code behind on the Page Load, couldn't you just set the table's visible property to the negation of EditDowntimeMode ? That would seem to be a better solution than trying to mix all that markup together in what you are doing.
Something like this in the Page_Load method of the code behind:
Table1.Visible = Not EditDowntimeMode
The given example code in the question should be updated if that is the case as the example code has the if blocking out everything within the table. You could use an ASP:Panel block and control its visibility for another idea or possibly nest the tables so that an inner table could be just what the "EditDowntimeMode" would show is in its own table.

Resources