amillyard
asked on
c# asp using the .style.visibility server-side (aspx.cs)
Development Platform: c#, asp.net 2.x, Visual Studio Pro utilising Web Developer, IIS 6, SQL Server 2005
the following script line is working fine within the .aspx form, can make the DropDownList visible or hidden).
onclick="document.getEleme ntById('Dr opDownList _StaffMemb ers').styl e.visibili ty = 'hidden';"
how do I perform this action from the server-side of things...i.e. inside a PreRender procedure?
protected void Page_PreRender(object sender, EventArgs e)
{
ViewState["_isChecked"] = RadioButton_Role.Checked;
if (Convert.ToBoolean(ViewSta te["_isChe cked"]))
{
RadioButton_Role.Checked = true;
RadioButton_StaffMember.Ch ecked = false;
DropDownList_StaffMembers. style.visi bility = "hidden"; //this line is not compiling
}
else
{
RadioButton_Role.Checked = false;
RadioButton_StaffMember.Ch ecked = true;
DropDownList_StaffMembers. style.visi bility = 'visible'; //this line is not compiling
}
}
thank you in advance for your time and efforts with this enquiry.
the following script line is working fine within the .aspx form, can make the DropDownList visible or hidden).
onclick="document.getEleme
how do I perform this action from the server-side of things...i.e. inside a PreRender procedure?
protected void Page_PreRender(object sender, EventArgs e)
{
ViewState["_isChecked"] = RadioButton_Role.Checked;
if (Convert.ToBoolean(ViewSta
{
RadioButton_Role.Checked = true;
RadioButton_StaffMember.Ch
DropDownList_StaffMembers.
}
else
{
RadioButton_Role.Checked = false;
RadioButton_StaffMember.Ch
DropDownList_StaffMembers.
}
}
thank you in advance for your time and efforts with this enquiry.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@dstanley9
yes, this certainly works ... but, when I click on the radio button again, it refuses to reappear -- I suspect its because the above visibility is the overall visibility control setting?
below is the script I use on the form to hide and show the drop down list, depending on which radio button you select.
as is stands now, when the page refreshes and gets pre-rendered, the drop down list now disappears and remains that way -- even with the radio button to select option again is used.
your thoughts are much apprieated.
<td style="width: 366px">
<asp:RadioButton ID="RadioButton_Role" runat="server" Font-Size="X-Small" GroupName="PipelineSpooler Task" Text="Role" onclick="document.getEleme ntById('Dr opDownList _StaffMemb ers').styl e.visibili ty = 'hidden';"/>
<asp:RadioButton ID="RadioButton_StaffMembe r" runat="server" Font-Size="X-Small" GroupName="PipelineSpooler Task" Text="Staff Member" onclick="document.getEleme ntById('Dr opDownList _StaffMemb ers').styl e.visibili ty = 'visible';" Checked="True" />
<asp:DropDownList ID="DropDownList_StaffMemb ers" runat="server" DataSourceID="SqlDataSourc e_StaffMem bers"
DataTextField="DisplayName " DataValueField="CompanyAge nt_ID">
</asp:DropDownList>
</td>
yes, this certainly works ... but, when I click on the radio button again, it refuses to reappear -- I suspect its because the above visibility is the overall visibility control setting?
below is the script I use on the form to hide and show the drop down list, depending on which radio button you select.
as is stands now, when the page refreshes and gets pre-rendered, the drop down list now disappears and remains that way -- even with the radio button to select option again is used.
your thoughts are much apprieated.
<td style="width: 366px">
<asp:RadioButton ID="RadioButton_Role" runat="server" Font-Size="X-Small" GroupName="PipelineSpooler
<asp:RadioButton ID="RadioButton_StaffMembe
<asp:DropDownList ID="DropDownList_StaffMemb
DataTextField="DisplayName
</asp:DropDownList>
</td>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am getting the following compilier error as follows:
'System.Web.UI.WebControls