Click here to Skip to main content
12,697,294 members (25,223 online)
   

ASP.NET

 
GeneralRe: ERROR while updating image in database Pin
Richard Deeming11-Dec-12 1:54
memberRichard Deeming11-Dec-12 1:54 
GeneralRe: ERROR while updating image in database Pin
jkirkerx11-Dec-12 8:26
memberjkirkerx11-Dec-12 8:26 
Questionmaking a class with streamreader thread safe - perhaps using monitor or a singleton Pin
jkirkerx9-Dec-12 12:45
memberjkirkerx9-Dec-12 12:45 
GeneralRe: making a class with streamreader thread safe - perhaps using monitor or a singleton Pin
jkirkerx9-Dec-12 17:14
memberjkirkerx9-Dec-12 17:14 
QuestionDisplay Images from a database in a tile view Pin
Member 94655649-Dec-12 6:42
memberMember 94655649-Dec-12 6:42 
AnswerRe: Display Images from a database in a tile view Pin
Ali Al Omairi(Abu AlHassan)10-Dec-12 3:23
memberAli Al Omairi(Abu AlHassan)10-Dec-12 3:23 
Questionlinq connection in asp.net Pin
JonBrynjar8-Dec-12 4:58
memberJonBrynjar8-Dec-12 4:58 
AnswerRe: linq connection in asp.net Pin
@AmitGajjar11-Dec-12 8:00
member@AmitGajjar11-Dec-12 8:00 
QuestionChange root path Pin
John Simmons / outlaw programmer8-Dec-12 4:40
mvpJohn Simmons / outlaw programmer8-Dec-12 4:40 
AnswerRe: Change root path Pin
Richard Deeming10-Dec-12 2:35
memberRichard Deeming10-Dec-12 2:35 
GeneralRe: Change root path Pin
John Simmons / outlaw programmer10-Dec-12 2:42
mvpJohn Simmons / outlaw programmer10-Dec-12 2:42 
AnswerRe: Change root path Pin
@AmitGajjar11-Dec-12 8:10
member@AmitGajjar11-Dec-12 8:10 
QuestionUpdating the column using entity framework Pin
indian1437-Dec-12 13:46
memberindian1437-Dec-12 13:46 
Questionasp.NET composite control cannot raise an event Pin
michal.cerbak7-Dec-12 5:50
membermichal.cerbak7-Dec-12 5:50 
I have problem with Composite Control in ASP.NET. Im making a classlibrary with this content \/ , but the problem is, that i cannot see it in toolbox, but i register it in web.config file, compile it and add a reference to it. And another problem is that my composite control cannot raise an event. 


<pre>// composite control
namespace MyCompControl
{
    public class CreateArticleEventArgs : EventArgs
    {
        public bool IsValid { get; private set; }
        public Article article { get; private set; }

        public CreateArticleEventArgs(bool IsValid, Article article)
        {
            this.IsValid = IsValid;
            this.article = article;
        }

        public CreateArticleEventArgs(bool IsValid)
        {
            this.IsValid = IsValid;
            this.article = null;
        }
    }

    [
    AspNetHostingPermission(SecurityAction.Demand,
        Level = AspNetHostingPermissionLevel.Minimal),
    AspNetHostingPermission(SecurityAction.InheritanceDemand,
        Level = AspNetHostingPermissionLevel.Minimal),
    DefaultEvent("Submit"),
    DefaultProperty("ButtonText"),
    ToolboxData("<{0}:CreateArticle runat="\""server\"> </{0}:CreateArticle>"),
    ]
    public class CreateArticleControl : Control, INamingContainer
    {

        private Label labelHeader;
        private Label labelIntro;
        private Label labelImage;
        private Label labelImageText;
        private Label labelText;
        private Label labelFileUploadStatus;
        private TextBox textBoxHeader;
        private TextBox textBoxIntro;
        private TextBox textBoxText;
        private TextBox textBoxImageText;
        private FileUpload fileUpload;
        private Button buttonCreateArticle;

        private static readonly object EventCreateArticleKey = new object();

        //public event EventHandler<CreateArticleEventArgs> CreateArticleClicked;

        #region Create Article Event Delegate
        [
        Category("Action"),
        Description("Raised when the user clicks the button.")
        ]
        public event EventHandler CreateArticle
        {
            add
            {
                Events.AddHandler(EventCreateArticleKey, value);
            }
            remove
            {
                Events.RemoveHandler(EventCreateArticleKey, value);
            }
        }
        #endregion

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            HttpContext.Current.Trace.Warn("OnLoad");
            if (!Page.IsPostBack)
            {
                EnsureChildControls();
            }
        }

        protected override void CreateChildControls()
        {
            HttpContext.Current.Trace.Warn("CreateChildControls");

            // hlavicka
            labelHeader = new Label();
            labelHeader.Text = "Header:";
            Controls.Add(labelHeader);

            textBoxHeader = new TextBox();
            Controls.Add(textBoxHeader);

            // intro k clanku
            labelIntro = new Label();
            labelIntro.Text = "Intro:";
            Controls.Add(labelIntro);

            textBoxIntro = new TextBox();
            Controls.Add(textBoxIntro);

            // text clanku
            labelText = new Label();
            labelText.Text = "Text:";
            Controls.Add(labelText);

            textBoxText = new TextBox();
            Controls.Add(textBoxText);

            // upload obrazku
            labelImage = new Label();
            labelImage.Text = "Image Upload:";
            Controls.Add(labelImage);

            fileUpload = new FileUpload();
            Controls.Add(fileUpload);

            labelFileUploadStatus = new Label();
            labelFileUploadStatus.Text = "";
            Controls.Add(labelFileUploadStatus);

            labelImageText = new Label();
            labelImageText.Text = "Image Subscription:";
            Controls.Add(labelImageText);

            textBoxImageText = new TextBox();
            Controls.Add(textBoxImageText);

            // vloz clanok
            buttonCreateArticle = new Button();
            buttonCreateArticle.ID = "buttonInsertArticleID";
            buttonCreateArticle.Text = "Insert Article";
            buttonCreateArticle.Click += new EventHandler(buttonCreateArticle_Click);

            //base.CreateChildControls();
        }

        protected override void Render(HtmlTextWriter writer)
        {
            labelHeader.RenderControl(writer);
            textBoxHeader.RenderControl(writer);
            labelIntro.RenderControl(writer);
            textBoxIntro.RenderControl(writer);
            labelText.RenderControl(writer);
            textBoxText.RenderControl(writer);
            labelImage.RenderControl(writer);
            fileUpload.RenderControl(writer);
            labelFileUploadStatus.RenderControl(writer);
            labelImageText.RenderControl(writer);
            textBoxImageText.RenderControl(writer);
            buttonCreateArticle.RenderControl(writer);
        }

        protected virtual void OnCreateArticle(CreateArticleEventArgs e)
        {
            EventHandler SubmitHandler = (EventHandler)Events[EventCreateArticleKey];
            if (SubmitHandler != null)
            {
                SubmitHandler(this, e);
            }
        }

        void buttonCreateArticle_Click(object source, EventArgs e)
        {
            string filepath = "";
            if (fileUpload.HasFile)
            {
                filepath = HttpContext.Current.Server.MapPath("~/pictures/") + fileUpload.FileName;
                fileUpload.SaveAs(filepath);
            }

            OnCreateArticle(
                new CreateArticleEventArgs(true, new Article()
                {
                    Author = HttpContext.Current.User.Identity.Name,
                    CreationDate = DateTime.Now,
                    Header = textBoxHeader.Text,
                    Intro = textBoxIntro.Text,
                    Image = filepath,
                    ImageText = textBoxImageText.Text
                }));
        }

    }
}

// register it in web.config
<add tagPrefix="mycc" assembly="MyCompControl" namespace="MyCompControl" />

// create an instance
<mycc:CreateArticleControl ID="cac" runat="server"     oncreatearticle="cac_CreateArticle">        
</mycc:CreateArticleControl>


A would be glad for any advice...
Questionhow to convert hex to rgb color code in asp.net Pin
Deenuji vellore7-Dec-12 0:14
groupDeenuji vellore7-Dec-12 0:14 
AnswerRe: how to convert hex to rgb color code in asp.net Pin
Richard MacCutchan7-Dec-12 1:32
mvpRichard MacCutchan7-Dec-12 1:32 
Questionasp.net threads, see if thread with same name is running to wait a couple of seconds Pin
jkirkerx6-Dec-12 11:45
memberjkirkerx6-Dec-12 11:45 
AnswerRe: asp.net threads, see if thread with same name is running to wait a couple of seconds Pin
Keith Barrow7-Dec-12 6:21
mentorKeith Barrow7-Dec-12 6:21 
GeneralRe: asp.net threads, see if thread with same name is running to wait a couple of seconds Pin
jkirkerx7-Dec-12 7:47
memberjkirkerx7-Dec-12 7:47 
QuestionPagination worries Pin
cizu6-Dec-12 6:12
membercizu6-Dec-12 6:12 
AnswerRe: Pagination worries Pin
deflinek7-Dec-12 2:40
memberdeflinek7-Dec-12 2:40 
AnswerRe: Pagination worries Pin
AnkitGoel.com10-Dec-12 18:33
memberAnkitGoel.com10-Dec-12 18:33 
QuestionHtml Mail Formate Error Pin
mukusingh5-Dec-12 19:49
membermukusingh5-Dec-12 19:49 
AnswerRe: Html Mail Formate Error Pin
jkirkerx6-Dec-12 11:41
memberjkirkerx6-Dec-12 11:41 
GeneralRe: Html Mail Formate Error Pin
mukusingh6-Dec-12 20:18
membermukusingh6-Dec-12 20:18 
Questionhow to set og tag at runtime Pin
Jassim Rahma5-Dec-12 10:12
memberJassim Rahma5-Dec-12 10:12 
AnswerRe: how to set og tag at runtime Pin
deflinek7-Dec-12 2:50
memberdeflinek7-Dec-12 2:50 
Questionis this a correct og prefix? Pin
Jassim Rahma5-Dec-12 8:36
memberJassim Rahma5-Dec-12 8:36 
Questionasp.net vb Pin
Nada ALsalami5-Dec-12 4:09
memberNada ALsalami5-Dec-12 4:09 
AnswerRe: asp.net vb Pin
ryanb315-Dec-12 5:34
memberryanb315-Dec-12 5:34 
GeneralRe: asp.net vb Pin
Nada ALsalami5-Dec-12 6:05
memberNada ALsalami5-Dec-12 6:05 
GeneralRe: asp.net vb Pin
ryanb315-Dec-12 8:17
memberryanb315-Dec-12 8:17 
AnswerRe: asp.net vb Pin
jkirkerx5-Dec-12 18:22
memberjkirkerx5-Dec-12 18:22 
GeneralRe: asp.net vb Pin
Nada ALsalami6-Dec-12 2:56
memberNada ALsalami6-Dec-12 2:56 
AnswerRe: asp.net vb Pin
jkirkerx6-Dec-12 8:32
memberjkirkerx6-Dec-12 8:32 
GeneralRe: asp.net vb Pin
jkirkerx6-Dec-12 12:36
memberjkirkerx6-Dec-12 12:36 
GeneralRe: asp.net vb Pin
Nada ALsalami12-Dec-12 6:03
memberNada ALsalami12-Dec-12 6:03 
GeneralRe: asp.net vb Pin
jkirkerx12-Dec-12 6:55
memberjkirkerx12-Dec-12 6:55 
GeneralRe: asp.net vb Pin
Nada ALsalami12-Dec-12 22:14
memberNada ALsalami12-Dec-12 22:14 
Question70-513 Video Tutorial Please Pin
silentspeaker5-Dec-12 3:45
membersilentspeaker5-Dec-12 3:45 
AnswerRe: 70-513 Video Tutorial Please Pin
Richard MacCutchan5-Dec-12 3:55
mvpRichard MacCutchan5-Dec-12 3:55 
GeneralRe: 70-513 Video Tutorial Please Pin
silentspeaker5-Dec-12 8:05
membersilentspeaker5-Dec-12 8:05 
QuestionDataList with Product Heads. Pin
Asif Rehman4-Dec-12 8:17
memberAsif Rehman4-Dec-12 8:17 
AnswerRe: DataList with Product Heads. Pin
Himanshu Yadav4-Dec-12 19:53
memberHimanshu Yadav4-Dec-12 19:53 
QuestionHI,how to do access sqlserver use windows domain user? Pin
xut24473-Dec-12 20:20
memberxut24473-Dec-12 20:20 
AnswerRe: HI,how to do access sqlserver use windows domain user? Pin
J4amieC3-Dec-12 23:24
memberJ4amieC3-Dec-12 23:24 
GeneralRe: HI,how to do access sqlserver use windows domain user? Pin
Andrew Stoute4-Dec-12 5:25
memberAndrew Stoute4-Dec-12 5:25 
Questionaspnet_wp process crash Pin
Kishore Hyd3-Dec-12 13:11
memberKishore Hyd3-Dec-12 13:11 
QuestionRe: aspnet_wp process crash Pin
ryanb315-Dec-12 5:36
memberryanb315-Dec-12 5:36 
JokeRe: aspnet_wp process crash Pin
jkirkerx5-Dec-12 18:27
memberjkirkerx5-Dec-12 18:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 20 Jan 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid