Click here to Skip to main content
15,890,336 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionRandom number Pin
idea_00720-Jun-10 19:12
idea_00720-Jun-10 19:12 
AnswerRe: Random number Pin
Abhijit Jana20-Jun-10 19:13
professionalAbhijit Jana20-Jun-10 19:13 
AnswerRe: Random number Pin
PSK_20-Jun-10 19:55
PSK_20-Jun-10 19:55 
Questionhow to handle users at the same time to get different primarkey value Pin
developerit19-Jun-10 23:15
developerit19-Jun-10 23:15 
AnswerRe: how to handle users at the same time to get different primarkey value Pin
Not Active20-Jun-10 1:49
mentorNot Active20-Jun-10 1:49 
AnswerRe: how to handle users at the same time to get different primarkey value Pin
Tej Aj20-Jun-10 21:20
Tej Aj20-Jun-10 21:20 
GeneralRe: how to handle users at the same time to get different primarkey value Pin
developerit20-Jun-10 21:47
developerit20-Jun-10 21:47 
QuestionAdding control and serverside script to page dynamically Pin
Fayu19-Jun-10 17:26
Fayu19-Jun-10 17:26 
I have some text (shown below) which I want to add to the page. This text contains server side script which I would also like to add dynamically. Is this a possibility?

So far I have attempted to add the text as controls using Page.ParseControl. This successfully adds the controls (textbox and button) to the page but the button events are not working (postback so far looks good).

After researching this further, several possibilities came into play. The first was CodeCompiler and the second was Dynamic Language Extensibility Model (DLEM). I have not read too much into DLEM but the article I read talked mostly about IronPython so this approach may not work in my scenario. In any case, both of these seem like overkill.

I figured before I continue with my research, I would ask for suggestions from the community.

Here are my questions:
1) Are the above possibilities a reasonable approach?
2) Is there something else I should be looking into?
3) Is it even possible to add server side scripts to a page dynamically?

Thanks in advance.

    protected override void OnInit(EventArgs e)
    {

        string formText = @"
<script runat=""server"">

    protected void Page_Load(object sender, EventArgs e)
    {
        
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        ((Button)sender).Text = TextBox1.Text;
    }
</script>

<asp:TextBox ID=""TextBox1"" runat=""server""></asp:TextBox>
<asp:Button ID=""btn1"" runat=""server"" onclick=""Button1_Click""></asp:Button>
";
        Control dControl = Page.ParseControl(formText);

        Page.Form.Controls.Add(dControl);

        base.OnInit(e);
    }

AnswerRe: Adding control and serverside script to page dynamically Pin
Not Active20-Jun-10 1:43
mentorNot Active20-Jun-10 1:43 
GeneralRe: Adding control and serverside script to page dynamically [modified] Pin
Fayu20-Jun-10 4:41
Fayu20-Jun-10 4:41 
GeneralRe: Adding control and serverside script to page dynamically Pin
Not Active20-Jun-10 4:44
mentorNot Active20-Jun-10 4:44 
GeneralRe: Adding control and serverside script to page dynamically Pin
Fayu20-Jun-10 5:12
Fayu20-Jun-10 5:12 
GeneralRe: Adding control and serverside script to page dynamically Pin
Not Active20-Jun-10 9:21
mentorNot Active20-Jun-10 9:21 
GeneralRe: Adding control and serverside script to page dynamically Pin
Fayu20-Jun-10 12:27
Fayu20-Jun-10 12:27 
AnswerRe: Adding control and serverside script to page dynamically Pin
NeverHeardOfMe20-Jun-10 4:01
NeverHeardOfMe20-Jun-10 4:01 
GeneralRe: Adding control and serverside script to page dynamically Pin
Fayu20-Jun-10 4:39
Fayu20-Jun-10 4:39 
QuestionLock down a web site's allowable IP range to just one IP address [modified] Pin
jpang00119-Jun-10 15:43
jpang00119-Jun-10 15:43 
AnswerRe: Lock down a web site's allowable IP range to just one IP address Pin
DaveAuld19-Jun-10 23:46
professionalDaveAuld19-Jun-10 23:46 
GeneralRe: Lock down a web site's allowable IP range to just one IP address Pin
jpang00120-Jun-10 3:35
jpang00120-Jun-10 3:35 
GeneralRe: Lock down a web site's allowable IP range to just one IP address Pin
Dimitri Witkowski20-Jun-10 3:57
Dimitri Witkowski20-Jun-10 3:57 
AnswerRe: Lock down a web site's allowable IP range to just one IP address Pin
DaveAuld20-Jun-10 4:20
professionalDaveAuld20-Jun-10 4:20 
Question.asp Pin
AndyInUK19-Jun-10 12:19
AndyInUK19-Jun-10 12:19 
AnswerRe: .asp Pin
NeverHeardOfMe19-Jun-10 13:25
NeverHeardOfMe19-Jun-10 13:25 
QuestionProcessing webpage post (automated) Pin
David Hovey19-Jun-10 11:27
David Hovey19-Jun-10 11:27 
QuestionGoogleMap as UserControl, using ModalPopup Pin
giantsover19-Jun-10 3:54
giantsover19-Jun-10 3:54 

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.