Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Visible panel on If condition problems

$
0
0

I have to display a dropdownlist (inside an asp:panel control) if a user is from the U.S. or Canada , but if they are from another foreign country, i need to display a textbox instead of the dropdownlist. The country is carried from session object after logging in, stored in session var:

<!--aspx page:-->

<asp:Panel id="showddCity" runat="server">  
 ...other sqldatasource code....
   <asp:DropDownList  
       id="ddCity"         DataSourceID="sqlcity"         DataTextField="City"         DataValueField="City"         Runat="server" />
  </asp:Panel>   
  <asp:Panel id="showtboxForeign" Runat="server" Visible="false">
  <asp:TextBox ID="tboxForeign" Runat="server" Width="250px" Height="100px">
</asp:TextBox>
  </asp:Panel>

//code behind:
string uuscan;  
  string uc;    
uuscan = dt.Rows[0]["CountryAb"].ToString();    
uc = Session["uCountryAb"].ToString();       
 if  (uc  == "US" |  uc  == "CAN") 
  {
ddCity.Visible = true;   
 }
   else
   {  
  ddCity.Visible = false;    tboxForeign.Visible = true;  
  }    

....but I can't get the textbox to appear for foreign user, the dropdownlist appears either way.

????
tia

chumley


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>