I have one table inside update panel, in which i show some data from database, some image buttons and some sharing icons(
spam link removed). When my page loads it shows all information, buttons and share icons but as i click on botton the share icons hides. When i refresh page then its again shows. Why it is hiding when button click.
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table>
<tr>
<td colspan="5">
<asp:ImageButton ID="btn_like" runat="server" ToolTip="Like" onclick="btn_like_Click1" OnClientClick="Show('shareicons');" />
<asp:ImageButton ID="btn_favorite" runat="server" ToolTip="Favorite" onclick="btn_favorite_Click1"/>
<asp:ImageButton ID="btn_spam" runat="server" ToolTip="Spam" onclick="btn_spam_Click1"/>
</td>
</tr>
<tr>
<td colspan="5">
<span class='st_facebook_large' displayText='Facebook' title="Share this Ad on Facebook"></span>
<span class='st_googleplus_large' displayText='Google +' title="Share this Ad on Google+"></span>
<span class='st_twitter_large' displayText='Tweet' title="Share this Ad on Twitter"></span>
<span class='st_linkedin_large' displayText='LinkedIn' title="Share this Ad on LinkedIn"></span>
<span class='st_email_large' displayText='Email' title="Share this Ad on Email"></span>
<span class='st_sharethis_large' displayText='ShareThis' title="More Sharing Options"></span>
</td>
</tr>
</table>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btn_like" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btn_favorite" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btn_spam" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
protected void btn_like_Click1(object sender, ImageClickEventArgs e)
{
if (null == Session["advertise"] || Session["advertise"] == null)
{
ScriptManager.RegisterStartupScript(this, typeof(string), "Error", "alert('Please login to Like this Advertisement.');", true);
}
else
{
ses = Session["advertise"].ToString();
SqlCommand cmd = new SqlCommand("sps_checklike", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@ad_id", ad_id);
cmd.Parameters.AddWithValue("@email", ses);
cmd.Parameters.Add("@ERROR", SqlDbType.Int);
cmd.Parameters["@ERROR"].Direction = ParameterDirection.Output;
con.Open();
cmd.ExecuteNonQuery();
int s = (int)cmd.Parameters["@ERROR"].Value;
con.Close();
if (s == 1)
{
SqlCommand cmd3 = new SqlCommand("sps_decreaselike", con);
cmd3.CommandType = CommandType.StoredProcedure;
cmd3.Parameters.AddWithValue("@ad_id", ad_id);
cmd3.Parameters.AddWithValue("@email", ses);
con.Open();
cmd3.ExecuteNonQuery();
con.Close();
btn_like.ImageUrl = "http://localhost:37698/Finder/Images/likeinactive.png";
LoadDetails();
}
else
{
SqlCommand cmd2 = new SqlCommand("sps_increaselike", con);
cmd2.CommandType = CommandType.StoredProcedure;
cmd2.Parameters.AddWithValue("@ad_id", ad_id);
cmd2.Parameters.AddWithValue("@email", ses);
con.Open();
cmd2.ExecuteNonQuery();
con.Close();
btn_like.ImageUrl = "http://localhost:37698/Finder/Images/likeactive.png";
LoadDetails();
}
}
}