private void FillFilters(DeviceFilter df) { ((TextBox)gvDevices.HeaderRow.FindControl("txtIMEI")).Text = df.IMEIFilter; ((TextBox)gvDevices.HeaderRow.FindControl("txtModel")).Text = df.ModelFilter; ((TextBox)gvDevices.HeaderRow.FindControl("txtProvider")).Text = df.ProviderFilter; ((DropDownList)gvDevices.HeaderRow.FindControl("ddlUnit")).SelectedValue = df.UnitFilter; ((DropDownList)gvDevices.HeaderRow.FindControl("ddlType")).SelectedValue = df.TypeFilter; ((DropDownList)gvDevices.HeaderRow.FindControl("ddlStatus")).SelectedValue = df.StatusFilter; ((DropDownList)gvDevices.HeaderRow.FindControl("ddlTaxType")).SelectedValue = df.TaxTypeFilter; ((TextBox)gvDevices.HeaderRow.FindControl("txtEmployee")).Text = df.EmployeeFilter; }
protected void gvDevices_DataBound(object sender, EventArgs e) { DeviceFilter df = ViewState["df"] as DeviceFilter ?? new DeviceFilter(); FillFilters(df); if (gvDevices.PageCount > 1) { int maxcount = gvDevices.PageCount * gvDevices.PageSize; int mincount = maxcount - gvDevices.PageSize; lblRowCount.Text = $"{mincount}-{maxcount} resultater"; } else { int count = gvDevices.Rows.Count; lblRowCount.Text = $"{count} resultat{(count != 1 ? "er" : "")}"; } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { DeviceFilter df = GetFilledDeviceFilter(); sdsDevices.FilterParameters["@IMEI"].DefaultValue = df.IMEIFilter; sdsDevices.FilterParameters["@Model"].DefaultValue = df.ModelFilter; sdsDevices.FilterParameters["@Provider"].DefaultValue = df.ProviderFilter; sdsDevices.FilterParameters["@Unit"].DefaultValue = df.UnitFilter; sdsDevices.FilterParameters["@Type"].DefaultValue = df.TypeFilter; sdsDevices.FilterParameters["@Status"].DefaultValue = df.StatusFilter; sdsDevices.FilterParameters["@TaxType"].DefaultValue = df.TaxTypeFilter; sdsDevices.FilterParameters["@Employee"].DefaultValue = df.EmployeeFilter; gvDevices.DataBind(); FillFilters(df); } }