PDA

View Full Version : StyleSheet.css Picture Problem


asifakhtar
02-27-2010, 10:23 PM
Why StyleSheet.css is not displaying the picture depends on the situation. It displays “Taken!“ or "Available!" but no picture. I am using Ajax with asp.net

My StyleSheet.css


#UserAvailability
{
padding-left: 22px;
margin-left: 5px;
float: left;
background-position: left;
background-repeat: no-repeat;
}

.taken
{
background-image: url(Images/taken.gif);
}

.available
{
background-image: url(Images/available.gif);
}

My Users.aspx


<ajax:UpdatePanel runat="server" ID="upUserName" >
<ContentTemplate>

<asp:TextBox ID="txtUserName" runat="server" AutoPostBack="true" OnTextChanged="txtUserName_Changed" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please Enter User Name" ControlToValidate="txtUserName" SetFocusOnError="True" >*</asp:RequiredFieldValidator>

<div runat="server" id="UserAvailability"></div>

</ContentTemplate>
</ajax:UpdatePanel>

My Users.aspx.cs

protected void txtUserName_Changed(object sender, EventArgs e)
{
if (Membership.GetUser(txtUserName.Text) != null)
{
UserAvailability.InnerText = "Taken!";
UserAvailability.Attributes.Add("class", "taken");
this.txtUserName.Text = "";
}
else
{
UserAvailability.InnerText = "Available!";
UserAvailability.Attributes.Add("class", "available");
}

this.UserAvailability.Visible = true;
}

abduraooft
02-28-2010, 12:31 PM
It displays “Taken!“ or "Available!" but no picture. I am using Ajax with asp.net
We can't execute and test that code to reproduce the error. Can we have a link to your page?

asifakhtar
03-01-2010, 09:18 PM
We can't execute and test that code to reproduce the error. Can we have a link to your page?

Thank you very much for the reply. I figured it out. The path to the images was incorrect.
Thanks