Click here to Skip to main content
15,885,244 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Link Button on User Control not firing? Pin
AndyASPVB4-Feb-10 22:41
AndyASPVB4-Feb-10 22:41 
GeneralRe: Link Button on User Control not firing? Pin
Rhys Jacob4-Feb-10 22:45
Rhys Jacob4-Feb-10 22:45 
GeneralRe: Link Button on User Control not firing? Pin
Ravindra Nidhonkar5-Feb-10 0:37
Ravindra Nidhonkar5-Feb-10 0:37 
GeneralRe: Link Button on User Control not firing? Pin
AndyASPVB5-Feb-10 0:53
AndyASPVB5-Feb-10 0:53 
GeneralRe: Link Button on User Control not firing? Pin
AndyASPVB5-Feb-10 0:52
AndyASPVB5-Feb-10 0:52 
GeneralRe: Link Button on User Control not firing? Pin
Ravindra Nidhonkar5-Feb-10 1:04
Ravindra Nidhonkar5-Feb-10 1:04 
GeneralRe: Link Button on User Control not firing? Pin
AndyASPVB5-Feb-10 1:31
AndyASPVB5-Feb-10 1:31 
GeneralRe: Link Button on User Control not firing? Pin
Rhys Jacob5-Feb-10 1:57
Rhys Jacob5-Feb-10 1:57 
This is a simple example of recreating your control on postback. So assuming that works and you still have the problem: is there any validation on the front end? Could it be that the form isn't valid so you don't get the postback?

public partial class WebUserControl1 : System.Web.UI.UserControl
    {
        static int x = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                if (ViewState["x"] != null)
                {
                    CreateLB();
                }
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            CreateLB();
        }

        private void CreateLB()
        {
            LinkButton lb = new LinkButton();
            lb.Text = "click me";
            lb.Click += new EventHandler(lb_Click);
            this.Controls.Add(lb);
            ViewState["x"] = true;
        }

        void lb_Click(object sender, EventArgs e)
        {
            x += 1;
            Label1.Text = x.ToString();
        }
    }


front end:

<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

GeneralRe: Link Button on User Control not firing? Pin
AndyASPVB5-Feb-10 2:30
AndyASPVB5-Feb-10 2:30 
GeneralRe: Link Button on User Control not firing? Pin
AndyASPVB5-Feb-10 3:33
AndyASPVB5-Feb-10 3:33 
GeneralRe: Link Button on User Control not firing? Pin
Rhys Jacob5-Feb-10 5:47
Rhys Jacob5-Feb-10 5:47 
GeneralRe: Link Button on User Control not firing? Pin
AndyASPVB5-Feb-10 5:57
AndyASPVB5-Feb-10 5:57 
QuestionOn demand combo in asp.net Pin
Tridip Bhattacharjee4-Feb-10 21:24
professionalTridip Bhattacharjee4-Feb-10 21:24 
AnswerRe: On demand combo in asp.net Pin
sashidhar4-Feb-10 21:58
sashidhar4-Feb-10 21:58 
AnswerRe: On demand combo in asp.net Pin
Anurag Gandhi4-Feb-10 22:05
professionalAnurag Gandhi4-Feb-10 22:05 
QuestionFile download completed in client machine or not detection Pin
Tridip Bhattacharjee4-Feb-10 21:23
professionalTridip Bhattacharjee4-Feb-10 21:23 
Questionscrren shot aspx page ? Pin
Subin Mavunkal4-Feb-10 21:23
Subin Mavunkal4-Feb-10 21:23 
AnswerRe: scrren shot aspx page ? Pin
R. Giskard Reventlov4-Feb-10 21:26
R. Giskard Reventlov4-Feb-10 21:26 
GeneralRe: scrren shot aspx page ? Pin
yrishi4-Feb-10 22:10
yrishi4-Feb-10 22:10 
GeneralRe: scrren shot aspx page ? Pin
R. Giskard Reventlov4-Feb-10 23:18
R. Giskard Reventlov4-Feb-10 23:18 
GeneralRe: scrren shot aspx page ? Pin
yrishi4-Feb-10 23:28
yrishi4-Feb-10 23:28 
GeneralRe: scrren shot aspx page ? Pin
R. Giskard Reventlov4-Feb-10 23:55
R. Giskard Reventlov4-Feb-10 23:55 
GeneralRe: scrren shot aspx page ? Pin
Subin Mavunkal4-Feb-10 23:33
Subin Mavunkal4-Feb-10 23:33 
AnswerRe: scrren shot aspx page ? Pin
nainakarri4-Feb-10 22:10
nainakarri4-Feb-10 22:10 
GeneralRe: scrren shot aspx page ? Pin
Subin Mavunkal4-Feb-10 22:17
Subin Mavunkal4-Feb-10 22:17 

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.