I definitely would research the client id aspect via Javascript as CK
suggested, but why would you want to do this via javascript, when you
can actually do the same thing through the page load of your
respective page? I presume you have a valid reason, but consider
this....
I've setup a dummy dropdown box and a dummy button on the ASPX page:
<asp:DropDownList ID="drpType" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="drpType_SelectedIndexChanged">
<asp:ListItem Text="0" Value="" Selected="True"-></asp:ListItem>
<asp:ListItem Text="1" Value="1"></asp:ListItem>
</asp:DropDownList><br />
<br />
<asp:Button ID="btnConType" runat="server" Text="Button" />
And added the following basic code in the code behind (Page Load):
if (drpType.SelectedValue == "")
{
btnConType.Visible = false;
}
else if (drpType.SelectedValue == "1")
{
btnConType.Visible = true;
}
With this option, I'm able to hide/show the button in both Firefox and
IE, though a postback is done in either case. I'm sure you still can
add this feature through your try/catch section still.
I'm sure there are other ways (possibly better ways) to do this too.
Let me know what you, or anyone else here, thinks about this. I'm
always up for learning different viewpoints.
On Oct 4, 11:26 am, JaffaB <[EMAIL PROTECTED]> wrote:
> All,
>
> I have an ASP.NET application which works 100% in Internet Explorer,
> but has a fault when run in FireFox. On one form, I have a drop down
> control which when a value is set, makes a command box visible. When
> the drop down is used in Internet Explorer, the button appears but in
> Firefox, the command box stays invisible. The coding for this
> control is done in the ASPX java code as follows:
>
> At the start of the code, I set the attributes on the drop down to
> call the show commands as follows:
>
> drpType.Attributes.Add("onChange",
> "JavaScript:ShowButtonsOnConnection();")
>
> Then we have the main command to make the button visible and change
> the button text as follows:
>
> function ShowButtonsOnConnection()
> {
> try{
> if
> (document.getElementById('ctl00$ContentPlaceHolder1$drpType').value=='Null')
> {document.getElementById('ctl00_ContentPlaceHolder1_btnConType').style.visibility='hidden';}
>
> else if
> (document.getElementById('ctl00$ContentPlaceHolder1$drpType').value=='O')
> {document.getElementById('ctl00_ContentPlaceHolder1_btnConType').style.visibility='visible';
> document.getElementById('ctl00_ContentPlaceHolder1_btnConType').value='ODBC
> Admin';}
>
> }
>
> catch(response)
> {
>
> }
> }
>
> Can anybody suggest how I get this to function in Firefox?
>
> Thanks
>
> Jaffa