HTML:
for popup extender control paste this after <%@page....%>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
and
paste this inside contentplaceholder1
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:TextBox ID="txtGuest" runat="server"></asp:TextBox>
<asp:PopupControlExtender ID="txtGuest_PopupControlExtender" runat="server" DynamicServicePath=""
Enabled="True" ExtenderControlID="" TargetControlID="txtGuest" PopupControlID="Panel1"
OffsetY="22">
</asp:PopupControlExtender>
<asp:Panel ID="Panel1" runat="server" Style="display: none; background-color: #F2F2F2;
border-style: solid; border-width: 1px; overflow: auto; top: 0; visibility: visible;
width: 306px; z-index: 1000;">
<asp:CheckBoxList ID="chkLGuest" runat="server" DataTextField="Name" DataValueField="Id"
AutoPostBack="True" OnSelectedIndexChanged="chkLGuest_SelectedIndexChanged">
</asp:CheckBoxList>
</asp:Panel>
</div>
c# code:
load check box :
chkLGuest.DataSource = new GuestManager().GetAllGuests();
chkLGuest.DataBind();
protected void chkLGuest_SelectedIndexChanged(object sender, EventArgs e)
{
string name = "";
for (int i = 0; i < chkLGuest.Items.Count; i++)
{
if (chkLGuest.Items[i].Selected)
{
name += chkLGuest.Items[i].Text + ",";
}
}
txtGuest.Text = name;
}
similarly for guestId we use item.selected.
No comments:
Post a Comment