can i send a server control from the aspx.cs page
A:
add a label to your form
in your code behind file [cs file]
label1.Text="<a href='your url'>LinkButton</a>";
Searock
2009-05-18 07:54:38
I fail to see how this would help in creating a LinkButton control instance in the page?
Fredrik Mörk
2009-05-18 07:57:11
i have edited my code
Searock
2009-05-18 08:06:17
Adding a control declaration to the Text property like that isn't going to do anything except render out the declaration as text on the page.
Zhaph - Ben Duguid
2009-05-18 10:18:26
well have you tried it ?
Searock
2009-05-19 04:03:40
have a look at this pagehttp://www.maconstateit.net/tutorials/ASPNET1/ASPNET03/aspnet03-01.aspx
Searock
2009-05-19 04:27:19
ok sorry works only with html controlsit cant render server controls
Searock
2009-05-19 04:31:43
@Searock: Zhaph - Ben Duguid is quite correct. Try to understand what is happening here... When you insert HTML markup into the text value of a control, it is rendered on the client as-is. It does not become a part of the Page controls collection. On a side note, I wanted to give you a vote just for mentioning David Adams' tutorials (one of my favourites!), but as you can see, your answer is incorrect.
Cerebrus
2009-05-19 07:12:23
+5
A:
If by "send" you mean "create", then you can do it easily by adding the dynamically created control to a container such as the Page or a Panel:
LinkButton lnk1 = new LinkButton();
// Set any required properties.
...
// Add the control to the container.
Panel1.Controls.Add(lnk1);
The LinkButton will be rendered at the client as expected.
Cerebrus
2009-05-18 07:57:13