Click here to Skip to main content
15,912,578 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionHow to run multiple Setup in single setup deployment in .net Pin
Piyush Vardhan Singh23-Apr-08 1:24
Piyush Vardhan Singh23-Apr-08 1:24 
QuestionHow do I make Multiple views of the page Pin
smajonga23-Apr-08 1:01
smajonga23-Apr-08 1:01 
GeneralRe: How do I make Multiple views of the page Pin
Christian Graus23-Apr-08 1:03
protectorChristian Graus23-Apr-08 1:03 
GeneralRe: How do I make Multiple views of the page Pin
Spunky Coder23-Apr-08 1:14
Spunky Coder23-Apr-08 1:14 
GeneralBind Table and it's content dynamically to Datalist [modified] Pin
sjs4u23-Apr-08 0:38
sjs4u23-Apr-08 0:38 
GeneralRe: Bind Table and it's content dynamically to Datalist Pin
Christian Graus23-Apr-08 0:45
protectorChristian Graus23-Apr-08 0:45 
GeneralRe: Bind Table and it's content dynamically to Datalist Pin
sjs4u23-Apr-08 1:24
sjs4u23-Apr-08 1:24 
Questiondynamically adding controls - or the limit of ASP.NET....... Pin
causalfriend23-Apr-08 0:34
causalfriend23-Apr-08 0:34 
.... or i'm just not clever enough to get it.

Hi

I struggle over the same problem all the time and i know there are different solutions to handle it, but non of them makes me happy.

Imagine the following aspx-page:
<br />
<asp:Panel ID="Panel1" runat="server"></asp:Panel><br />
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder><br />


with the code:
<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
   TextBox t = new TextBox();<br />
   t.Text = DateTime.Now.ToString();<br />
   addLinkButton(" value 0 ");<br />
}<br />
private void addLinkButton(string value)<br />
{<br />
    LinkButton b = new LinkButton();<br />
    b.Text = value;<br />
    b.Click += new System.EventHandler(testClick);<br />
    PlaceHolder1.Controls.Add(b);<br />
}<br />
protected void testClick(object sender, EventArgs e)<br />
{<br />
    PlaceHolder1.Controls.Clear();<br />
    addLinkButton(" value 1 ");<br />
    Label l = new Label();<br />
    l.ID = "thelabel";<br />
    l.Text = "the text";<br />
    Panel1.Controls.Add(l);<br />
}<br />
<br />


After clicking the linkButton the second time the handler won't be fired. i know that i could set the Test of the linkButton different (i could define the button globally and access it by the variable name in the handler.the thing is: this example is just very simplified. the LinkButton might be some very complex structure. Example: A list of Controls including Controls. So if i build up the complex list in page_load and in the handler i need to move Controls to other positions its NOT an option to remove list-items from controls to add it at different places. on the other sideI might want to update a database in the event-handler and re-read the structure, like i re-created the linkButton with a different Text.

so what i need is the example above to be solved.
i'm very desperate about this problem Frown | :(

thanks for every input (and if possible i would love to have an explanation why the example doesnt work).

if i look at the page life cycle i cant see any problem creating the event-handler in a handler since i can create controls there. and of course a handler is part of a control!
GeneralRe: dynamically adding controls - or the limit of ASP.NET....... Pin
Christian Graus23-Apr-08 0:44
protectorChristian Graus23-Apr-08 0:44 
GeneralRe: dynamically adding controls - or the limit of ASP.NET....... Pin
causalfriend23-Apr-08 1:37
causalfriend23-Apr-08 1:37 
Generalproblem with stored procedure Pin
eyeseetee23-Apr-08 0:32
eyeseetee23-Apr-08 0:32 
GeneralRe: problem with stored procedure Pin
J4amieC23-Apr-08 0:45
J4amieC23-Apr-08 0:45 
GeneralRe: problem with stored procedure Pin
eyeseetee23-Apr-08 0:59
eyeseetee23-Apr-08 0:59 
GeneralRe: problem with stored procedure Pin
eyeseetee23-Apr-08 1:04
eyeseetee23-Apr-08 1:04 
GeneralRe: problem with stored procedure Pin
Christian Graus23-Apr-08 1:09
protectorChristian Graus23-Apr-08 1:09 
GeneralRe: problem with stored procedure Pin
Christian Graus23-Apr-08 1:05
protectorChristian Graus23-Apr-08 1:05 
GeneralRe: problem with stored procedure Pin
eyeseetee23-Apr-08 1:09
eyeseetee23-Apr-08 1:09 
GeneralRe: problem with stored procedure Pin
Christian Graus23-Apr-08 1:12
protectorChristian Graus23-Apr-08 1:12 
GeneralRe: problem with stored procedure Pin
J4amieC23-Apr-08 1:13
J4amieC23-Apr-08 1:13 
GeneralRe: problem with stored procedure Pin
eyeseetee23-Apr-08 1:13
eyeseetee23-Apr-08 1:13 
GeneralRe: problem with stored procedure Pin
Christian Graus23-Apr-08 1:16
protectorChristian Graus23-Apr-08 1:16 
GeneralRe: problem with stored procedure Pin
eyeseetee23-Apr-08 1:25
eyeseetee23-Apr-08 1:25 
GeneralRe: problem with stored procedure Pin
eyeseetee23-Apr-08 1:29
eyeseetee23-Apr-08 1:29 
Generalpath of file Pin
ptvce23-Apr-08 0:21
ptvce23-Apr-08 0:21 
GeneralRe: path of file Pin
Christian Graus23-Apr-08 0:42
protectorChristian Graus23-Apr-08 0:42 

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.