SharePoint - Adding C# Scripts on Dispform.aspx that hides rows

Asked By jc dls on 14-May-13 03:28 AM

i have a Custom List Form, which is inserted on DIspForm.aspx, i want a row in this form to be hidden after some conditions.. But this throws an error "Too many characters in character literal "


//script inside my Main Contentplaceholder

<script type="text/c#" runat="server">
protected override void OnLoad(EventArgs e)
{

SPSite site = SPContext.Current.Site;
SPGroup groupHR = site.RootWeb.SiteGroups["Site Owners"];

if(groupHR.ContainsCurrentUser)
{
rowConfidential.Style.Add("display", "none");
}
else
{
rowNotConfidential.Style.Add("display", "none");
}
}
< /script>



//code for my row in the dataviewwebpart

<tr id="rowConfidential" runat="server">
<td width="190px" valign="top" class="ms-formlabel">
<H3 class="ms-standardheader">
<nobr>Confidential</nobr>
</H3>
</td>
<td width="400px" valign="top" class="ms-formbody">
<xsl:value-of select="@Confidential"/>
</td>
</tr>