paging option was not working inside updatepanel and iam using masterpage in the masterpage iam having the scriptmanager
give solution pla asap..
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Prasad BhagatPosted Aug 27, 2014, 1:12 AM
----------------
AutoGenerateColumns="False" DataKeyNames="id" OnPageIndexChanging="gvRef_PageIndexChanging"
PageSize="5" AllowPaging="true" OnRowDataBound="gvRef_RowDataBound" OnSorting="gvRef_Sorting" OnRowCommand="gvRef_RowCommand">
<%--
No Profiles ...
Default.aspx.cs
---------------------
private void LoadGridView()
{
GatewayEntities gt = new GatewayEntities();
IFormatProvider culture = new CultureInfo("en-US", true);
string opName = "0"; int? opCode = 0; string canName = "0"; string emilId = "0"; string mobile = "0"; string notice = "0";
string recName = "0"; string keySkill = "0"; int profStatus = 0; int countryId = 0;
DateTime? postedDate = Convert.ToDateTime("01/01/2000");
int clientId = 0;
DateTime fDate = Convert.ToDateTime("01/01/2000");
DateTime tDate = Convert.ToDateTime("01/01/2000");
if (Request.QueryString.Count == 2 && Session["click"] == null)
{
ddlProfStatus.SelectedIndex = ddlProfStatus.Items.IndexOf(ddlProfStatus.Items.FindByText(Request.QueryString[1].ToString()));
}
else if (Request.QueryString.Count >= 3 && Session["click"] == null)
{
ddlProfStatus.SelectedIndex = ddlProfStatus.Items.IndexOf(ddlProfStatus.Items.FindByText(Request.QueryString[2].ToString()));
}
if (txtOpeningName.Text != string.Empty)
opName = txtOpeningName.Text;
if (txtOpeningCode.Text != string.Empty)
opCode = Convert.ToInt32(txtOpeningCode.Text.Trim());
else
opCode = null;
if (txtCandidateName.Text != string.Empty)
canName = txtCandidateName.Text;
if (txtEmailId.Text != string.Empty)
emilId = txtEmailId.Text;
if (txtMobile.Text != string.Empty)
mobile = txtMobile.Text;
if (txtNotice.Text != string.Empty)
notice = txtNotice.Text;
if (txtRecruiterName.Text != string.Empty)
recName = txtRecruiterName.Text;
if (txtKeySkill.Text.Length > 0)
keySkill = txtKeySkill.Text;
if (ddlProfStatus.SelectedIndex > 0)
profStatus = Convert.ToInt32(ddlProfStatus.SelectedValue);
if (txtPostedDate.Text.Length > 0)
{
DateTime dts = Convert.ToDateTime(txtPostedDate.Text);
postedDate = dts;// (DateTime.ParseExact(dts, "dd/MM/yyyy", culture)).ToShortDateString(); //Convert.ToDateTime(Convert.ToDateTime(txtPostedDate.Text).ToShortDateString());
}
if (ddlCountry.SelectedIndex > 0)
countryId = Convert.ToInt32(ddlCountry.SelectedValue);
//client search from todate
if (ddlClient.SelectedIndex > 0)
clientId = Convert.ToInt32(ddlClient.SelectedValue);
if (txtFroDate.Text.Length > 0)
fDate = Convert.ToDateTime(txtFroDate.Text);
if (txtToDate.Text.Length > 0)
tDate = Convert.ToDateTime(txtToDate.Text);
Session["searchCo"] = null;
Session["searchCo"] = opName.ToString() + "," + opCode + "," + canName + "," + emilId + "," + mobile + "," + notice + "," + recName + "," + keySkill + "," + profStatus + "," + postedDate + "," + countryId;
if (ViewState["export"] != null)
{
//FOR EXPORT TO EXCEL
int id = 0;
var exp = gt.usp_search_profiles_client_dates101(opName, opCode == null ? 0 : opCode, canName, emilId, mobile, notice, recName, (opCode == 0 && opCode != null) ? "2" : "0", keySkill, profStatus, countryId, fDate, tDate, clientId).ToList();
var expo = (from c in exp
select new
{
Id = c.id,
CandidateName = c.candidate_name,
opening_name = c.opening_name,
Client = c.Client,
PostedDate = c.submitted_date,
Recruiter = c.submitted_by_name,
KeySkills = c.key_skills,
Exp = c.exp_years,
ContactNumber = c.contact_number,
AvailToJoin = c.notice_period,
CurrentLocation = c.current_location,
CurrentPackage = c.current_package,
OfferedPackage = c.proposed_package,
ConsultCheck = ConsultChecked(c.id),
EmpType = c.EMP_TYPE
}).ToList();
GridView1.AllowPaging = false;
CheckBox chk = (CheckBox)gvRef.HeaderRow.FindControl("chkAll");
if (chk.Checked == true)
GridView1.DataSource = expo.ToList();
else
GridView1.DataSource = expo.Where(d => d.ConsultCheck == "true").ToList();
GridView1.DataBind();
GridView1.Visible = true;
if (GridView1.Rows.Count > 0)
{
lblMsg.Text = "";
}
else
{
lblMsg.Text = "Please Select Profiles and Click again";
return;
}
//FOR EXPORT TO EXCEL
}
else
{
gvRef.DataSource = objCs.GetConsultants(opName, opCode, canName, emilId, mobile, notice, recName, keySkill, profStatus, countryId, fDate, tDate, clientId);
gvRef.DataBind();
///count
int RecordsCount = gt.usp_search_profiles_client_dates101(opName, opCode == null ? 0 : opCode, canName, emilId, mobile, notice, recName, (opCode == 0 && opCode != null) ? "2" : "0", keySkill, profStatus, countryId, fDate, tDate, clientId).ToList().Count();
lblSearchCount.Text = RecordsCount > 0 ? RecordsCount.ToString() + " Records found.." : "No Records found";
}
gt = null;
}
protected void gvRef_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gvRef.PageIndex = e.NewPageIndex;
LoadGridView();
upd.Update();
}
this is my coding update panel must use becoz i have some more events for that but give me solution
Saineshwar BageriPosted Aug 27, 2014, 12:48 AM
2) you have give Event of Gridview
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
// Bind gridview here
}
mark as answer if i had help you.