I have a table within an updatepanel and it displays the information as the page loads. When I press a button the updatepanel refreshes and the information goes away. In debug it shows it looping through but not displaying on website.
<div class="col-xs-12 col-md-6" style="margin-top: 10px;">
<div id="notificationsTab" class="tab" style="background-color: #AD816B;">
<a style="color: black; text-decoration: none;"> Notification</a>
<div id="button3" class="button4">
</div>
</div>
<div class="toggler2">
<div id="effect2" class="">
<asp:UpdatePanel ID="notifications" runat="server" BackColor="#AD816B" BorderColor="#724229"
BorderStyle="Inset" class="notifications" UpdateMode="Conditional">
<ContentTemplate>
<div class="mCustomScrollbar content3 fluid light">
<div class="notificationsDay">
<table id="testingtesting">
<tr>
<td style="width: 15%">
Action
</td>
<td style="width: 55%">
Description
</td>
<td style="width: 30%">
Date Added
</td>
</tr>
<% for (int i = 0; i <= ***.Count - 1; i++)
{
string action = Get2DHashtableElement(*** i, "***");
%>
<tr>
<%if (action == "Checked In Appt")
{%>
<td>
<center>
<a class="fancybox fancybox.iframe" href=***?id=<%= Get2DHashtableElement(***, i, "***")%>'>
<img src="images/httpzcoolcomcnpicpngpng_7420png.png" border="0" style="height: 25px;
width: 25px;" /></a>
</center>
</td>
<%} %>
<td>
<%= Get2DHashtableElement(mhc_notification, i, "Description")%>
</td>
<td>
<%= Get2DHashtableElement(mhc_notification, i, "AddedDate")%>
</td>
</tr>
<%} %>
</table>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnTesting" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</div>
</div>
</div>
The button is a simple button
<asp:Button ID="btnTesting" runat="server" onclick="btnTesting_Click"
Text="Action" />
and here is the c#
protected void btnTesting_Click(object sender, EventArgs e)
{
using (SqlConnection connection = new SqlConnection(strConnString))
{
int sKey = Convert.ToInt32(ViewState["sKey"]);
DateTime now = DateTime.Now;
string today = now.ToString("MM/dd/yyyy");
SqlCommand cmd = new SqlCommand("INSERT INTO *** (Staffkey, ClientKey, ActionKey, Description) VALUES (@Staffkey, @ClientKey, @ActionKey, @Description)");
cmd.CommandType = CommandType.Text;
cmd.Connection = connection;
cmd.Parameters.AddWithValue("@Staffkey", sKey);
cmd.Parameters.AddWithValue("@ClientKey", **);
cmd.Parameters.AddWithValue("@ActionKey", "Checked In Appt");
cmd.Parameters.AddWithValue("@Description", "test , greg2 is Checked in for their" + today + "Appointment");
connection.Open();
cmd.ExecuteNonQuery();
}
All it does is add someone to the database and is supposed to update the table after add. I don't want to refresh the whole page just the panel.
I've looked around but mostly all I see is gridviews. I also tried jquery.load and tried to reload the div its self to see if that would work but to no evail. }