Click here to Skip to main content
15,907,001 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My website has two sections, admin and user.
In admin section I am using ckfinder which fills pages like 'home' and 'contact us' in the admin section.
The 'home' and 'contact us' page content is stored in a database.
In the user section I am just displaying these filled pages through database by their respective id in code behind.
All is working fine.
But problem is this:
In the 'contact us' page I need it that if the user fills contact us form and clicks on submit button then the message should be displayed showing that the record is filled.
The contactus form content is stored in database.
The content is like:
Collapse
XML
<label>Name:</label><input id="uname" name="uname" type="text" /><br />
    <br />
    <label>Phone:</label><input id="phone" name="phone" type="text" /><br />
    <br />
    <label>Email:</label><input id="email" name="email" type="text" /><br />
    <br />
    <label>Message:</label><textarea cols="40" id="msg" name="msg" rows="10"></textarea><br />
    <br />
    <label> </label><input type="submit" value="Submit"  onserverclick="submit_onclick"   runat="server"   /><asp:Button
        ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />


This content is stored in database and displayed in user section.
The control and button displayed, but how can I call the click event which is in database?
In code behind of contact us form I used:

C#
WebPageContent obj = new WebPageContent();
        divContent.InnerHtml = obj.getContent(5);
Posted
Updated 10-Dec-10 2:14am
v2
Comments
Abdul Quader Mamun 10-Dec-10 8:14am    
Format question correctly.

1 solution

It appears you are not using ASP.NET for what it give you. ASP.NET has server controls which can be bound to rather creating and replacing raw html elements as it appears you are doing.

If you want a message to be displayed after the button click then place a Label control on your page with initial visibility set to false. In the button click event handler set it to true.
 
Share this answer
 
Comments
balongi 10-Dec-10 9:35am    
i am using asp.net... but the button control is come through database which is html control
[no name] 10-Dec-10 10:27am    
You can't just add HTML elements directly and expect the ASP.NET engine to recognize them. There is some underlying plumbing that happens when a server control is included and rendered.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900