Hi,
I am using the Modal popup controler for showing the notification of new message by using Panel control . In that panel control i am using a repeater .
In repeater i have lable and link button . After i show the notification message using linkbutton the unread message will become read . But in that i am unable to fire the click event in
the linkbutton.
my code is :
front end code:-
<asp:Panel ID="Panel3" runat="server" BackColor="white" style="display:none" BorderWidth="1" Width="500px" Height="200px" BorderColor="#108EBF">
<center>
<div class=" col-sm-5 ">
<asp:Repeater ID="rptnewmsg" runat="server" OnItemCommand="lnkmsgstatus_Command" >
<ItemTemplate>
<div style=" width:300px; height:150px; border:solid 0px red;">
<a style=" color:Black;"> File received from </a> <asp:Label ID="lblclientnamessTF" runat="server" Text='<%#Eval("Clientname") %>'></asp:Label> <a style=" color:Black;"> for </a> <asp:Label ID="Label2" runat="server" Text='<%#Eval("Boardtype") %>'></asp:Label><br />
<asp:LinkButton ID="lnkmsgstatus" runat="server" CommandArgument='<%Eval("Id") %>' CommandName="Unread" OnCommand="lnkmsgstatus_Command" Text="Unread" ></asp:LinkButton><br /><br />
</div>
</ItemTemplate>
</asp:Repeater>
<button id="btncancelss" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<div class="modal-body" style=" margin-top:50px;">
<%--
<div class="well">
<div class="form-group">
<h4 class=" col-sm-offset-5 " style=" color:Black; " >Post Comments</h4>
<label for="name">Comments</label><br /> <asp:TextBox ID="TextBox1" runat="server" CssClass=" form-control"></asp:TextBox><br /><br />
</div>
</div>--%>
</div>
</div>
</center>
</asp:Panel>
<asp:ModalPopupExtender ID="ModalPopupExtender3" BehaviorID="ModalPopupExtender3" runat="server" Enabled="true" PopupControlID="Panel3" TargetControlID="Panel3" CancelControlID="btncancelss" OnCancelScript="hidepopupss()" BackgroundCssClass="modalback">
</asp:ModalPopupExtender>
c# code :-
protected void lnkmsgstatus_Click(object sender, EventArgs e)
{
string lnkbtnmsg = (sender as LinkButton).CommandArgument;
con.Open();
SqlCommand cmdupdatemsg = new SqlCommand("update Newmessage set Readstatus ='" + 1 + "' where Id = '" + lnkbtnmsg + "'", con);
cmdupdatemsg.ExecuteNonQuery();
con.Close();
}
protected void Timer1_Tick(object sender, EventArgs e)
{
Newmsgbind();
ModalPopupExtender3.Show();
}
public void Newmsgbind()
{
SqlDataAdapter da_newmsg = new SqlDataAdapter("select Id,Clientname,Boardtype ,Date from Newmessage where Readstatus ='" + 0 + "'", con);
DataSet ds_newmsg = new DataSet();
da_newmsg.Fill(ds_newmsg);
rptnewmsg.DataSource = ds_newmsg;
rptnewmsg.DataBind();
}