コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string strRequest = Request.QueryString["s"];

            if (strRequest == "" || strRequest == null)
            {
                Response.Redirect("Default.aspx");
            }
            if (!Page.IsPostBack)
            {
                string strItem = Request.QueryString["i"];
                try
                {
                    //BIND TITLE IMAGE
                    sectionImage.ImageUrl += myDr.GetSectionImage(strRequest);
                }
                catch (Exception evt)
                {
                    lblError.Text = evt.Message;
                }
                if (strItem != null)
                {
                    //SHOW ITEM REQUESTED IN THE URL
                    try
                    {
                        Dictionary <string, string> itemData = myDr.GetItemDetails(strItem);
                        ViewImage(itemData);
                    }
                    catch (Exception evt)
                    {
                        lblError.Text = "Sorry, the request you made was not valid. Please click one of the section links above to view items in my portfolio.";
                    }
                }
                else
                {
                    try
                    {
                        //GET FEATURED ITEM
                        Dictionary <string, string> itemData = myDr.GetFeaturedItem(strRequest);
                        ViewImage(itemData);
                    }
                    catch (Exception evt)
                    {
                        lblError.Text = "Sorry, something appears to have gone wrong. Try your task again.";
                    }
                }

                try
                {
                    //GET LIST OF THUMBS
                    DataSet thumbList = myDr.GetThumbs(strRequest);
                    lvThumbs.DataSource = thumbList;
                    lvThumbs.DataBind();

                    LinkButton btnThumbLink = (LinkButton)lvThumbs.Items[2].FindControl("ThumbLink");

                    imgThumbPreview = (Image)lvThumbs.Items[2].FindControl("thumbImage");
                    ((WebPortfolioOld.masters.Main)Master).smScriptManagerProp.RegisterAsyncPostBackControl(btnThumbLink);
                }
                catch (Exception evt)
                {
                    lblError.Text     = "Sorry, there was a problem loading the thumbnails for the section you requested. Please click one of the current sections on the navigation above.";
                    pnlThumbs.Visible = false;
                }
            }

            //dlThumbs.DataSource = thumbList;
            //dlThumbs.DataBind();
        }