コード例 #1
0
    protected void gvRents_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        GridViewRow row          = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
        HiddenField hfListingID  = (HiddenField)row.FindControl("hfListingID");
        string      strListingID = hfListingID.Value;
        //if (e.CommandName.ToString() == "Down")
        //{
        MLS myMLS = new MLS();

        //ListingCollection lc = myMLS.getRents("edit");
        List <Listing> lListing = null;

        if (Request.QueryString["type_id"] != null)
        {
            myMLS.SwapSort(Convert.ToInt32(strListingID), Convert.ToInt32(e.CommandArgument.ToString()), Convert.ToInt32(Request.QueryString["type_id"].ToString()));
            lListing = myMLS.getListingsByTypeID(Convert.ToInt32(Request.QueryString["type_id"].ToString()), "edit");
        }
        else//Featured
        {
            myMLS.SwapFeaturedSort(Convert.ToInt32(strListingID), Convert.ToInt32(e.CommandArgument.ToString()), "featured");
            lListing = myMLS.getFeaturedListingsToAdmin();
        }
        gvRents.DataSource = lListing;
        gvRents.Columns[3].HeaderStyle.CssClass = "neutral";
        gvRents.DataBind();
        //Response.Write("From:" + strListingID + "<br/>");
        //Response.Write("To:" + e.CommandArgument.ToString() + "<br/>");

        //}
        //else if (e.CommandName.ToString() == "Up")
        //{
        //}
        //Response.Write(e.CommandName.ToString());
        //Response.Write(e.CommandArgument.ToString());
    }
コード例 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         MLS            myMLS    = new MLS();
         List <Listing> lListing = null;
         if (Request.QueryString["type_id"] != null)
         {
             lListing = myMLS.getListingsByTypeID(Convert.ToInt32(Request.QueryString["type_id"].ToString()), "edit");
         }
         else
         {
             lListing = myMLS.getFeaturedListingsToAdmin();
         }
         //ListingCollection lc = myMLS.getRents("edit");
         gvRents.DataSource = lListing;
         gvRents.Columns[3].HeaderStyle.CssClass = "neutral";
         gvRents.DataBind();
         this.Master.Change_Nav("Admin");
     }
 }