0% found this document useful (0 votes)
34 views11 pages

Multiple Column Filter in C

Multiple column filter using jquery
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views11 pages

Multiple Column Filter in C

Multiple column filter using jquery
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

using System;

using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DistriSoft;
using System.Data.SqlClient;
using System.Data;

public partial class ICS_AssignICSpdv : System.Web.UI.Page


{
#region Declaration
string mission_id;
DataSet ds = null;
//string ddlcsi;
BLMissionPDV _objMissionpdv;
Info _I;
#endregion
protected void Page_Load(object sender, EventArgs e)
{
SessionHandler _objSessionHandler = new SessionHandler(this.Page);
mission_id = Session["MasterMissionID"].ToString();
_objMissionpdv = new BLMissionPDV();
_I = new Info();
if (!IsPostBack)
{
ddlCommercial.Visible = false;
BindDDlICS();
ddlCSI_SelectedIndexChanged(sender, e);
// BindGrid();

}
}

//private void BindGrid()


//{

// _I._p_Mission_Id = mission_id;
// _I._p_Users_Id_Com = ddlCommercial.SelectedValue.ToString();
// _I._p_Users_Id_ICS = ddlCSI.SelectedValue.ToString();
// ds = _objMissionpdv.DisplayIcsPdvGrid(_I);
// gvIcsPdv.DataSource = ds;
// gvIcsPdv.DataBind();

//}

public SortDirection dir


{
get
{
if (ViewState["dirState"] == null)
{
ViewState["dirState"] = SortDirection.Ascending;
}
return (SortDirection)ViewState["dirState"];
}
set
{
ViewState["dirState"] = value;
}

// protected void gvIcsPdv_Sorting(object sender, GridViewSortEventArgs e)


//{
// BindGrid();
// DataTable dt = new DataTable();
// dt = ds.Tables[0];
// {
//

string SortDir = string.Empty;

//

if (dir == SortDirection.Ascending)

//

//

dir = SortDirection.Descending;

//

SortDir = "Desc";

//

//

else

//

//

dir = SortDirection.Ascending;

//

SortDir = "Asc";

//

//

DataView sortedView = new DataView(dt);

//

sortedView.Sort = e.SortExpression + " " + SortDir;

//

gvIcsPdv.DataSource = sortedView;

//

gvIcsPdv.DataBind();

// }
//}

#region Bind ICS


private void BindDDlICS()
{
try

DataSet ds = null;
_objMissionpdv = new BLMissionPDV();
_I = new Info();
_I._p_Mission_Id = mission_id;

ds = _objMissionpdv.MissionIcsDropdown(_I);
if (ds.Tables.Count > 0)
{

ddlCSI.DataSource = ds.Tables[0];
ddlCSI.DataValueField = "user_id";
ddlCSI.DataTextField = "FullName";
ddlCSI.DataBind();
}
ddlCommercial.Visible = true;
// CheckedCommercials();
}
catch (Exception)
{
throw;
}
}
#endregion

private void BindDLCommercials()


{
try

{
DataSet ds=null;
_objMissionpdv = new BLMissionPDV();
_I = new Info();
_I._p_Mission_Id = mission_id;

_I._p_Users_Id_ICS = ddlCSI.SelectedValue.ToString();

ds = _objMissionpdv.SetCommercial(_I);
if (ds.Tables.Count > 0)
{

ddlCommercial.DataSource = ds.Tables[0];
ddlCommercial.DataValueField = "user_id";
ddlCommercial.DataTextField = "FullName";
ddlCommercial.DataBind();
}
// CheckedCommercials();
}
catch (Exception)
{
throw;
}
}
protected void ddlCSI_SelectedIndexChanged(object sender, EventArgs e)
{
BindDLCommercials();
//BindGrid();
//ChkSelectAllEnabledfalse();

}
protected void ddlCommercial_SelectedIndexChanged(object sender, EventArgs e)
{

//BindGrid();
}

//protected void btnEdit_Click(object sender, EventArgs e)


//{
// //btnUpdate.Visible = true;
// //btnEdit.Visible = false;
// foreach (GridViewRow row in gvIcsPdv.Rows)
// {
//

if (row.RowType == DataControlRowType.DataRow)

//

//

CheckBox chkselect = (row.Cells[0].Controls[0] as CheckBox);

//

chkselect.Enabled = true;

//

// }
//}
protected void btnUpdate_Click(object sender, EventArgs e)
{
UpdateIcsPDvRepeater();
//ChkSelectAllEnabledfalse();
// UpdateIcsPDv();

}
//private void ChkSelectAllEnabledfalse()

//{
// foreach (GridViewRow row in gvIcsPdv.Rows)
// {
//

if (row.RowType == DataControlRowType.DataRow)

//

//

CheckBox chkselect = (row.Cells[0].Controls[0] as CheckBox);

//

chkselect.Enabled = false;

//

// }
// //btnUpdate.Visible = false;
// //btnEdit.Visible = true;
//}

//private void UpdateIcsPDv()


//{

// _objMissionpdv = new BLMissionPDV();


// _I = new Info();
// DataTable dt;
// _I._p_Mission_Id = mission_id;
// foreach (GridViewRow row in gvIcsPdv.Rows)
// {
//

string Rowid = gvIcsPdv.DataKeys[row.RowIndex].Value.ToString();

//

CheckBox chkselect = (row.Cells[0].Controls[0] as CheckBox);

//

if (chkselect.Checked == true)

//

//

try

//

//

/// Assign the value

//

if (Rowid != String.Empty)

//

//

///Update

//

_I._p_Pdv_Id = Rowid;

//

_I._p_Users_Id_ICS = ddlCSI.SelectedValue.ToString();

//

dt = _objMissionpdv.IcsPdvUpdate(_I).Tables[0];

//

//

//

catch (Exception ex)

//

//

EXClass.ExtoLog(ex);

//

//

//

else

//

//

_I._p_Pdv_Id = Rowid;

//

_I._p_Users_Id_ICS = DBNull.Value.ToString() ;

//

dt = _objMissionpdv.IcsPdvUpdate(_I).Tables[0];

//

// }

// lblError.Text = "Mise jour avec succs";

// gvIcsPdv.EditIndex = -1;
// BindGrid();
// //***
//}
private void UpdateIcsPDvRepeater()
{

_objMissionpdv = new BLMissionPDV();


_I = new Info();
DataTable dt;
_I._p_Mission_Id = mission_id;
foreach (RepeaterItem li in repPdvAssign.Items)
{

HiddenField hdnpdvid = (HiddenField)li.FindControl("hdnpdv_id");


string pdvid = hdnpdvid.Value;
CheckBox usersIdIcs = (CheckBox)li.FindControl("Users_Id_ICS");
if(usersIdIcs.Checked==true)
{
try
{
/// Assign the value

_I._p_Pdv_Id = pdvid;
_I._p_Users_Id_ICS = ddlCSI.SelectedValue.ToString();

dt = _objMissionpdv.IcsPdvUpdate(_I).Tables[0];

}
catch (Exception ex)

{
EXClass.ExtoLog(ex);
}
}
else
{
_I._p_Pdv_Id = pdvid;
_I._p_Users_Id_ICS = DBNull.Value.ToString() ;
dt = _objMissionpdv.IcsPdvUpdate(_I).Tables[0];
}
}
lblError.Text = "Mise jour avec succs";

protected void gvIcsPdv_RowDataBound(object sender, GridViewRowEventArgs e)


{
if (e.Row.RowType == DataControlRowType.DataRow)
{
CheckBox chkselect = (e.Row.Cells[0].Controls[0] as CheckBox);
chkselect.Enabled = true;
//if (e.Row.Cells[0].Text == "")
//{
// chkSelect.Enabled = false;
//}
//else
//{

//}
}

You might also like