<asp:Panel style="display:none;" ID="pnlFileAttachment" runat="server">
<table> <tr> <td> ANY CONTENT </td> </tr> </table>
</asp:Panel>
HERE IF IN PLACE OF style="display:none;" WE WILL GIVE VISIBILITY =FALSE THEN WE CAN NOT ACCESS THIS PANEL CONTROL FROM THE JAVASCRIPT BECAUSE WHEN WE MAKE A CONTROL DISPLAY NONE ITS NOT RENDER INTO THE PAGE ,SO WE WILL GET THE OBJECT NOT FOUND EXCEPTION IN THE JAVA SCRIPT
<td> <asp:RadioButton ID="rbtFileAttachmentYes" onclick="return AttachmentPanel('Yes');" runat="server" Text="Yes" GroupName="FileAttachment" />
<asp:RadioButton ID="rbtFileAttachmentNo" onclick="return AttachmentPanel('No');" runat="server" Text="No" GroupName="FileAttachment" />
</td>
<script language="javascript" type="text/javascript"> function AttachmentPanel(state)
{
if(state =="Yes")
document.getElementById('<%=pnlFileAttachment.ClientID%>').style.display='inline';
else if(state =="No")
document.getElementById('<%=pnlFileAttachment.ClientID%>').style.display='none';
}
</script>
IN THE PAGE LOAD
-----------------------------------------------------------------------------------------------
if (ds.Tables[0].Rows[0]["AllowCommentsToEvents"].ToString() == "Yes")
{
rbtCommentToEventYes.Checked = true;
pnlCommentToEvent.Style.Add(HtmlTextWriterStyle.Display, "inline");
} else if (ds.Tables[0].Rows[0]["AllowCommentsToEvents"].ToString() == "No")
{
rbtCommentToEventNo.Checked = true;
pnlCommentToEvent.Style.Add(HtmlTextWriterStyle.Display, "none");
}
IF WE NEED TO CHANGE THE VISIBILITY IF ANY CONTROLS FROM JAVA SCRIPT WE HAVE TO USE THIS PROCEDURE .
WHEN RADIO BUTTON YES WILL BE CHECKED THE PANEL WILL BE DISPLAYED AND WHEN THE RADIO BUTTON NO WILL BE CHECKED THE PANEL WILL NOT BE DISPLAYED.
<table> <tr> <td> ANY CONTENT </td> </tr> </table>
</asp:Panel>
HERE IF IN PLACE OF style="display:none;" WE WILL GIVE VISIBILITY =FALSE THEN WE CAN NOT ACCESS THIS PANEL CONTROL FROM THE JAVASCRIPT BECAUSE WHEN WE MAKE A CONTROL DISPLAY NONE ITS NOT RENDER INTO THE PAGE ,SO WE WILL GET THE OBJECT NOT FOUND EXCEPTION IN THE JAVA SCRIPT
<td> <asp:RadioButton ID="rbtFileAttachmentYes" onclick="return AttachmentPanel('Yes');" runat="server" Text="Yes" GroupName="FileAttachment" />
<asp:RadioButton ID="rbtFileAttachmentNo" onclick="return AttachmentPanel('No');" runat="server" Text="No" GroupName="FileAttachment" />
</td>
<script language="javascript" type="text/javascript"> function AttachmentPanel(state)
{
if(state =="Yes")
document.getElementById('<%=pnlFileAttachment.ClientID%>').style.display='inline';
else if(state =="No")
document.getElementById('<%=pnlFileAttachment.ClientID%>').style.display='none';
}
</script>
IN THE PAGE LOAD
-----------------------------------------------------------------------------------------------
if (ds.Tables[0].Rows[0]["AllowCommentsToEvents"].ToString() == "Yes")
{
rbtCommentToEventYes.Checked = true;
pnlCommentToEvent.Style.Add(HtmlTextWriterStyle.Display, "inline");
} else if (ds.Tables[0].Rows[0]["AllowCommentsToEvents"].ToString() == "No")
{
rbtCommentToEventNo.Checked = true;
pnlCommentToEvent.Style.Add(HtmlTextWriterStyle.Display, "none");
}
IF WE NEED TO CHANGE THE VISIBILITY IF ANY CONTROLS FROM JAVA SCRIPT WE HAVE TO USE THIS PROCEDURE .
WHEN RADIO BUTTON YES WILL BE CHECKED THE PANEL WILL BE DISPLAYED AND WHEN THE RADIO BUTTON NO WILL BE CHECKED THE PANEL WILL NOT BE DISPLAYED.