|
hi all,
i am developing a content management system in asp.net with C#. i have a master page named "Master1.master" with 5 content place holders-"cphHeader, cphLeft,cphCenter,cphright,cphbottom". i have another default.aspx page which is inherited from the "Master1.master". it takes as input,the following fields from the user :
1. text to be displayed.(Textbox)
2. Content holder where the text will be displayed (dropdown having names of all the 5 content holders mentioned above.).
these things entered by the user are stored in the database. The text entered by the user should be displayed in the content holder mentioned above.
How do i do it?? is there any facility which helps us access the content place holders on the default.aspx.cs page.
thanks in advance.please reply as soon as possible.
|
|
|
|
|
You can add it to the CPH Control's collection:
ContentPlaceHolder cph = (ContentPlaceHolder)Master.FindControl("PrimaryContent");<br />
if (cph != null)<br />
cph.Controls.Add(new LiteralControl("The text string"));
|
|
|
|
|
Im not too sure on this but would you be able to put the content holders in a global or common methods page, this way you can acces them from any page.
|
|
|
|
|
Hi guys,
Please forgive me, if it is a question frequent asked.
As you know, when we tried to submit a asp.net page with characters something like '<test>' filled in, and we would get an error as the subject.
How can the exception "A potentially dangerous Request.Form value was detected from the client" be handled without setting the validateRequest to false in the page directive or in the web.config file? because I just want to void this ASP.NET feature for only a single textbox, Any suggestions?
Thanks, Ming.
modified on Wednesday, April 2, 2008 10:28 AM
|
|
|
|
|
Set ValidateRequest=false on the page.
|
|
|
|
|
Hi N a v a n e e t h,
Thanks for your solution, but I think you don't understand what I am asking, you are alright, that is my fault, I didn't hightlight the key words.
The key word is without setting the validateRequest to false in the page directive or in the web.config file?
Cheers,
Ming
|
|
|
|
|
Bluebamboo wrote: The key word is without setting the validateRequest to false in the page directive or in the web.config file?
Ahh, I didn't noticed that . I don't think there is other way to do this. BTW, what is the problem for turning it off in page level or web.config ?
|
|
|
|
|
because the basic requirement is that I provide a online html editor (implemented by using textbox) which allows user types in html markup , and submit to database.
and also I have other textboxes on the same page which do need the asp.net pagevalidate feature,
is any solution? any suggestion would be appricated!
Cheers,
Ming
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Session["mysession"].ToString() != null)
{
Label1.Text = "Welcome " ;
}
else
{
Response.Redirect("Login.aspx");
}
}
}
I have the above code in one aspx page. Before logging in if someone opens this page, it should open Login page. But instead of showing theLogin page, it shows Server Error. Any one have an idea.
|
|
|
|
|
What error are you getting in the page ?
Could you clarify that
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Soumini Ramakrishnan wrote: if (Session["mysession"].ToString() != null)
This is wrong. It should be
if (Session["mysession"] != null)
{
Label1.Text = "Welcome " ;
}
else
{
Response.Redirect("Login.aspx");
} When session is null , you can't invoke it's ToString() method.
|
|
|
|
|
Hi,
I had made some changes in yr code, just see below.
Try this code, i hope u can not get an error...
if (!IsPostBack)
{
if (Session["mysession"] != null)
{
Label1.Text = "Welcome ";
}
else
{
Label1.Text = "test";
}
}
i hope it will help u..
Rana Krishnraj
modified on Wednesday, April 2, 2008 9:30 AM
|
|
|
|
|
Thank you all. The given hints helped me and I rectified my problem.
|
|
|
|
|
hai to all,
My requirement is ,i want to insert multiple no of rows on a single save command with differnt values in a data table.
I want to do this using stored procedure with transaction.i dont have any idea of using procedure for multiple columns.
how to do this??
i have 6 fields which i have to insert differnt values in each row.No of rows also varied.can anybody give me simple example so that i can implement in my application.
i want to commit the data iff no of rows i want to insert equal to count(*) from that perticular table.
How to do this??please give me idea.
thanks in advance
kissy
|
|
|
|
|
How are you inserting records right now? We can't help unless we know what database you're using and how you're connecting to it. The commands are different depending on your answer. Most languages (both client side and SQL implementations) have a BEGIN TRANSACTION, COMMIT TRANSACTION and ROLLBACK TRANSACTION statement of some kind. I suggest you look up those commands for the platform you're using.
|
|
|
|
|
Hai All,
My requirement is to show the contents of a word file as it is in a dynamic web page without loosing it's formats?
Note that there will be images and text in my word file?
WHAT I DID
i tries to convert the .doc file into an html file and stores the multilingual code in the database, from there iam showing the contents into a dynamic page.
My problem is that the alignment is been breaking as some images are in the .doc file.
help me pls because it seems to be a complex task ?
|
|
|
|
|
|
Hi All,
I'm developing one application in asp.net 2.0
In that application logged in user can view the pages. If the user close the page with out signing out means how can I maintain their login status?
If I use the javascript in body unload means, I have to implement this script in many of the pages.
Give some better idea to solve this prob.
Thanks in Advance
A.Muthunagai
|
|
|
|
|
Muthunagai.A wrote: If the user close the page with out signing out means how can I maintain their login status?
Are you maintaining any DB flags for user status ? Usually you need to check the session existence in each page_load. If session is not exist, redirect user to the login page.
|
|
|
|
|
What do you mean by
Muthunagai.A wrote: how can I maintain their login status
please elaborate
|
|
|
|
|
Yes,Maintain the username in a session,if there is a null value means,I will redirect to login page. There is no prob in that.
What I want is ,if the user suddenly used the window after logged in means how can I capture their status? and how to update the Database?
I updated the Databse for login status in sign out button click and session_end of Global.asax.
There are many pages in my application,after login.So How to update the database when the user suddenly closed the browser window?
|
|
|
|
|
There is one more way
Create a base class that will have a method which check the session if user is logged in or not call that method from page load of base class
Now your page should derived from this base class
Now if user closes the browser you want to sign out user
Create a cookie like person id for the session level and check that cookie
if user close the browser without sign out, then cookie will also get deleted now if he open in new browser the cookie will not be available
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
if the user clear the cookies means how can we maintain the status?
Any other idea? other then this?
|
|
|
|
|
First tell me what problem are you facing when user closes the browser without logged out. And open the application in new browser.
Muthunagai.A wrote: if the user clear the cookies means how can we maintain the status?
If user clears the cookie he will redirect to login page
Muthunagai.A wrote: Any other idea?
No friend, i don't see any other idea as you need to use client side state management for this as server never knows about the browser states whether it is open or closed
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
If the system suddenly hang or shoutdown means,how to maintain the login status?
|
|
|
|