SCRREN SHORT
CODE using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls;
public partial class gallry : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { fillgrid(); fil(); } }
protected void fillgrid() { DataTable dt = dataaccess.Returndata("select * from apkisakhi_category where status='1' order by category asc" ; ddlcategory.DataSource = dt; ddlcategory.DataTextField = dt.Columns["category"].ToString(); ddlcategory.DataValueField = dt.Columns["cat_code"].ToString(); ddlcategory.DataBind(); } protected void ddlcategory_SelectedIndexChanged(object sender, EventArgs e) { try { DataTable dt = dataaccess.Returndata("select * from apkisakhi_category where category='" + ddlcategory.SelectedItem.Text + "'"); if (dt.Rows.Count != 0) { DataList1.Visible = true; DataTable dt1 = dataaccess.Returndata("select * from apkisakhi_meta where cat_code='" + ddlcategory.SelectedValue.ToString() + "'"); if (dt1.Rows.Count > 0) { Session["title"] = dt1.Rows[0]["title"].ToString(); ss.InnerText = Session["title"].ToString(); } fil(); } else { Response.Write("<script>alert('choose one category')</script>"); DataList1.Visible = false; lblcat.Text = ""; } } catch (Exception) { Response.Write("<script>alert('Error')</script>"); } } protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e) { } public int currentpage { get { object o=this.ViewState["_c"]; if(o==null) return 0; else return(int)o; } set { this.ViewState["_c"]=value; } } private void fil() {
DataTable dt1 = dataaccess.Returndata("select * from apkisakhi_category where category='" + ddlcategory.SelectedItem.Text + "'"); Session["cat"] = dt1.Rows[0]["cat_code"].ToString(); lblcat.Text = dt1.Rows[0]["category"].ToString(); DataTable dt = dataaccess.Returndata("select * from apkisakhi_addjellewery where status='1' and cat_code='" + Session["cat"] + "' order by j_code asc "); PagedDataSource p = new PagedDataSource(); p.DataSource = dt.DefaultView; p.AllowPaging = true; p.PageSize = 15; p.CurrentPageIndex = currentpage; lblpage.Text="Page: "+" "+(currentpage+1).ToString()+" "+" of "+p.PageCount.ToString(); prev.Enabled = !p.IsFirstPage; next.Enabled = !p.IsLastPage; DataList1.DataSource = p; DataList1.DataBind(); } protected void prev_Click(object sender, EventArgs e) { currentpage -= 1; fil(); } protected void next_Click(object sender, EventArgs e) { currentpage += 1; fil(); } }
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: