<tr>
<td>
Select Center:
</td>
<td>
<asp:TextBox ID="txt_city" runat="server" BackColor="White" CssClass="textbox" placeholder="Select Centre"
ReadOnly="true" Width="300px"></asp:TextBox>
<cc1:PopupControlExtender ID="PopupContExtcity" runat="server" Enabled="True" ExtenderControlID=""
OffsetY="18" PopupControlID="pnl_city" TargetControlID="txt_city">
</cc1:PopupControlExtender>
<asp:Panel ID="pnl_city" runat="server" BackColor="White" BorderColor="#B3B1AD" BorderWidth="1px"
Direction="LeftToRight" Height="116px" ScrollBars="Auto" Style="display: none"
Width="300px">
<asp:CheckBox ID="chk_city_all" runat="server" AutoPostBack="false" Text="All" />
<asp:CheckBoxList ID="chklistCity" runat="server" AutoPostBack="false">
</asp:CheckBoxList>
</asp:Panel>
</td>
</tr>
=======================================================
<script language="javascript" type="text/javascript">
var ModalProgress = '<%= ModalProgress.ClientID %>';
function EndRequestHandler(sender, args) {
if (args.get_error() == undefined) {
chklistCity();
ChkListEnterBy();
}
}
$(function () {
chklistCity();
});
function chklistCity() {
$("[id*=chk_city_all]").bind("click", function () {
if ($(this).is(":checked")) {
$("[id*=chklistCity] input").attr("checked", "checked");
} else {
$("[id*=chklistCity] input").removeAttr("checked");
}
updatecity();
});
$("[id*=chklistCity] input").bind("click", function () {
if ($("[id*=chklistCity] input:checked").length == $("[id*=chklistCity] input").length) {
$("[id*=chk_city_all]").attr("checked", "checked");
} else {
$("[id*=chk_city_all]").removeAttr("checked");
}
updatecity();
});
function updatecity() {
var txt_city = "";
$("[id*=chklistCity] input:checked").each(function () {
txt_city += $(this).siblings("label").html() + ",";
});
//console.log(txtSubCity);
$("#<%= txt_city.ClientID %>").val(txt_city);
}
}
</script>
==============================================================
private void Bind_Center_CheckBox()
{
if (con.State != ConnectionState.Open)
{
con.Open();
}
//chklistCity.DataSource = clsc.Get_DataReader("Select SC_CODE,SC_DESC from ID_citymst order by SC_DESC", con);
//chklistCity.DataValueField = "SC_CODE";
//chklistCity.DataTextField = "SC_DESC";
chklistCity.DataSource = clsc.Get_DataReader("Select cc_centerno code,cc_name descr from id_check_up_centers where cc_active_yn='Y' order by CC_NAME", con);
chklistCity.DataValueField = "code";
chklistCity.DataTextField = "descr";
chklistCity.DataBind();
chk_city_all.Checked = true;
string strname = "";
foreach (ListItem item in chklistCity.Items)
{
item.Selected = true;
strname = strname + item.Text + ",";
}
txt_city.Text = strname;
ScriptManager.RegisterClientScriptBlock(UpdatePanel1, typeof(UpdatePanel), "jscript1", "chklistCity();", true);
}
<td>
Select Center:
</td>
<td>
<asp:TextBox ID="txt_city" runat="server" BackColor="White" CssClass="textbox" placeholder="Select Centre"
ReadOnly="true" Width="300px"></asp:TextBox>
<cc1:PopupControlExtender ID="PopupContExtcity" runat="server" Enabled="True" ExtenderControlID=""
OffsetY="18" PopupControlID="pnl_city" TargetControlID="txt_city">
</cc1:PopupControlExtender>
<asp:Panel ID="pnl_city" runat="server" BackColor="White" BorderColor="#B3B1AD" BorderWidth="1px"
Direction="LeftToRight" Height="116px" ScrollBars="Auto" Style="display: none"
Width="300px">
<asp:CheckBox ID="chk_city_all" runat="server" AutoPostBack="false" Text="All" />
<asp:CheckBoxList ID="chklistCity" runat="server" AutoPostBack="false">
</asp:CheckBoxList>
</asp:Panel>
</td>
</tr>
=======================================================
<script language="javascript" type="text/javascript">
var ModalProgress = '<%= ModalProgress.ClientID %>';
function EndRequestHandler(sender, args) {
if (args.get_error() == undefined) {
chklistCity();
ChkListEnterBy();
}
}
$(function () {
chklistCity();
});
function chklistCity() {
$("[id*=chk_city_all]").bind("click", function () {
if ($(this).is(":checked")) {
$("[id*=chklistCity] input").attr("checked", "checked");
} else {
$("[id*=chklistCity] input").removeAttr("checked");
}
updatecity();
});
$("[id*=chklistCity] input").bind("click", function () {
if ($("[id*=chklistCity] input:checked").length == $("[id*=chklistCity] input").length) {
$("[id*=chk_city_all]").attr("checked", "checked");
} else {
$("[id*=chk_city_all]").removeAttr("checked");
}
updatecity();
});
function updatecity() {
var txt_city = "";
$("[id*=chklistCity] input:checked").each(function () {
txt_city += $(this).siblings("label").html() + ",";
});
//console.log(txtSubCity);
$("#<%= txt_city.ClientID %>").val(txt_city);
}
}
</script>
==============================================================
private void Bind_Center_CheckBox()
{
if (con.State != ConnectionState.Open)
{
con.Open();
}
//chklistCity.DataSource = clsc.Get_DataReader("Select SC_CODE,SC_DESC from ID_citymst order by SC_DESC", con);
//chklistCity.DataValueField = "SC_CODE";
//chklistCity.DataTextField = "SC_DESC";
chklistCity.DataSource = clsc.Get_DataReader("Select cc_centerno code,cc_name descr from id_check_up_centers where cc_active_yn='Y' order by CC_NAME", con);
chklistCity.DataValueField = "code";
chklistCity.DataTextField = "descr";
chklistCity.DataBind();
chk_city_all.Checked = true;
string strname = "";
foreach (ListItem item in chklistCity.Items)
{
item.Selected = true;
strname = strname + item.Text + ",";
}
txt_city.Text = strname;
ScriptManager.RegisterClientScriptBlock(UpdatePanel1, typeof(UpdatePanel), "jscript1", "chklistCity();", true);
}
No comments:
Post a Comment