Example #1
0
        public void PopulateLabels()
        {
            // Grab QueryString Parameter
            string qString;

            qString = Request.QueryString["ID"];

            if (string.IsNullOrEmpty(qString))
            {
                // Get from Route
                qString = Page.RouteData.Values["ID"] as string;
            }

            // Update Select Parameter
            Sql_PageItems.SelectParameters["groupId"].DefaultValue = qString;
            Sql_Comments.SelectParameters["groupId"].DefaultValue  = qString;

            // Update Literal for Reference
            this.lit_groupId.Text = qString;

            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString);
            SqlCommand    cmd     = new SqlCommand("SELECT tbl_collection.collectionId, collectionName, tbl_group.collectionId, groupName, groupDescription, tbl_user.userId, tbl_group.userId, userName  FROM tbl_collection, tbl_group, tbl_user WHERE tbl_user.userId = tbl_group.userId AND tbl_collection.collectionId = tbl_group.collectionId AND groupId = '" + qString + "'", sqlConn);

            cmd.Connection.Open();

            SqlDataReader SqlDrItemList;

            SqlDrItemList = cmd.ExecuteReader();
            while (SqlDrItemList.Read())
            {
                string GroupTitle       = SqlDrItemList["groupName"].ToString();
                string GroupDescription = SqlDrItemList["groupDescription"].ToString();
                string AuthorName       = SqlDrItemList["userName"].ToString();
                string CollectionId     = SqlDrItemList["collectionId"].ToString();
                string CollectionName   = SqlDrItemList["collectionName"].ToString();

                this.lit_collectionId.Text   = CollectionId;
                this.lit_collectionName.Text = CollectionName;
                this.lit_GroupTitle.Text     = Helper.Trim(GroupTitle, 30);
                //this.txt_renamePage.Text = PageTitle;
                this.lit_GroupDescription.Text = Helper.Trim(GroupDescription, 420);
                //this.txt_renameDescription.Text = PageDescription;
                this.hyp_AuthorName.Text        = AuthorName;
                this.hyp_AuthorName.NavigateUrl = "/" + AuthorName;
                this.imb_author.PostBackUrl     = "/" + AuthorName;
                this.txt_rename.Text            = GroupTitle;
                this.txt_renameDescription.Text = GroupDescription;
                // Set Image Control URL
                imb_author.ImageUrl = "~/Images/Users/" + AuthorName + ".jpg";
            }

            cmd.Connection.Close();
            cmd.Connection.Dispose();
        }
Example #2
0
        public void PopulateLabels()
        {
            // Grab Querystring

            string qString;

            qString = Request.QueryString["ID"];

            if (string.IsNullOrEmpty(qString))
            {
                // Get From Route
                qString = Page.RouteData.Values["ID"] as string;
            }


            // Update Select Parameter
            Sql_Items.SelectParameters["itemId"].DefaultValue    = qString;
            Sql_Comments.SelectParameters["itemId"].DefaultValue = qString;

            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString);
            SqlCommand    cmd     = new SqlCommand("SELECT itemId, itemName, itemDescription, itemUrl, groupId, tbl_user.userId, tbl_item.userId, userName  FROM tbl_item, tbl_user WHERE tbl_user.userId = tbl_item.userId AND itemId = '" + qString + "'", sqlConn);

            cmd.Connection.Open();

            SqlDataReader SqlDrItemList;

            SqlDrItemList = cmd.ExecuteReader();
            while (SqlDrItemList.Read())
            {
                string ItemTitle       = SqlDrItemList["itemName"].ToString();
                string ItemDescription = SqlDrItemList["itemDescription"].ToString();
                string AuthorName      = SqlDrItemList["userName"].ToString();
                string ItemUrl         = SqlDrItemList["itemUrl"].ToString();
                this.lit_itemUrl.Text           = ItemUrl;
                this.lit_itemId.Text            = SqlDrItemList["itemId"].ToString();
                this.lit_groupId.Text           = SqlDrItemList["groupId"].ToString();
                this.hyp_AuthorName.Text        = AuthorName;
                this.hyp_AuthorName.NavigateUrl = "/" + AuthorName;
                this.imb_author.PostBackUrl     = "/" + AuthorName;
                this.txt_rename.Text            = ItemTitle;
                this.txt_renameDescription.Text = ItemDescription;


                // Set Image Control URL
                imb_author.ImageUrl = "~/Images/Users/" + AuthorName + ".jpg";

                // Set Edit Controls
                //this.txt_itemTitle.Text = ItemTitle;
                //this.txt_itemDescription.Text = ItemDescription;
            }
        }