I have a master page with three image buttons on. In the content below the master page i have listboxes and when i make a selection of an item on the list it opens a new list in the content. The problem is that when i make a selection the whole page is reloaded and the master page with the images reloads and makes like 1 second to come back all together. This is not very convenient as you may understand and its not for personal use program. Is it possible to make the post back work only for the field below and leave the master page untouched?
master page:
<%# Master Language="VB" CodeFile="MyMasterPage.master.vb" Inherits="MyMasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div id="topContent" align="center">
<table>
<tr>
<td style="width:400px;" align="right" axis="top">
</td>
<td>
<asp:Image ID="Image1" runat="server" ImageUrl="~/PetrolinaLetters.png" />
</td>
<td style="width:400px; text-align:center;" valign="top">
<asp:Label ID="userText" runat="server" BorderStyle="Double" Width="130px" Font-Bold="True"></asp:Label>
</td>
</tr>
</table>
<div>
<table>
<tr>
<td style="width:170px;">
<asp:ImageButton ID="ImageButton1" runat="server" Height="30px" ImageUrl="~/orderButton.png"
Width="160px" />
</td>
<td style="width: 170px;">
<asp:ImageButton ID="ImageButton2" runat="server" Height="30px" ImageUrl="~/orderHistory.png"
Width="160px" />
</td>
<td style="width:170px;">
<asp:ImageButton ID="ImageButton3" runat="server" Height="30px" ImageUrl="~/changePass.png"
Width="160px" />
</td>
</tr>
</table>
</div>
<br />
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
you will need to do partial postbacks (AKA: AJAX) in order to untouch the rest of your page elements, and still have the needed behavior from the list element.
A- Use jquery to capture the changed value, go to your web-server, and return back with the data (fast, and recommended, but need some work)
some useful examples:
http://jquerybyexample.blogspot.com/2012/04/how-to-populate-aspnet-dropdownlist.html
jQuery-AJAX to rebind dropdown list to results from stored procedure
http://amin-sayed.blogspot.com/2008/10/in-this-example-ill-demonstrate-how-to.html
B- Use an update panel around the controls that you need to update them without the rest of the page ( not that fast from a performance perspective, but extermly easy to implement)
http://www.asp.net/web-forms/tutorials/aspnet-ajax/understanding-asp-net-ajax-updatepanel-triggers
http://www.asp.net/ajax/documentation/live/tutorials/IntroductionUpdatePanel.aspx
http://www.netrostar.com/How-to-Use-NET-Update-Panel
Related
I'm new to ASP.NET and seems I screwed up my Web Form page that is based off of a Master.
It seems I mixed some invalid html codes but can't figure out why.
<%# Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Clips.aspx.cs" Inherits="Clip.Clips" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:EntityDataSource ID="entityDataSource" runat="server" ConnectionString="name=ClipEnt" DefaultContainerName="ClipEnt" EnableDelete="True" EnableFlattening="False" EnableInsert="True" EnableUpdate="True" EntitySetName="Clips" EntityTypeFilter="Clip" OnSelecting="EntityDataSource_Selecting">
</asp:EntityDataSource>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" DataSourceID="entityDataSource">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="True" />
</Columns>
</asp:GridView>
<div>
<h1>Sending Email</h1>
<table>
<tr>
<td>From:</td>
<td>
<asp:TextBox ID="txtFrom" runat="server" Width="250px"></asp:TextBox>
</td>
</tr>
<tr>
<td>From EMail:</td>
<td>
<asp:TextBox ID="txtFromEmail" runat="server" Width="250px"></asp:TextBox>
</td>
</tr>
<tr>
<td>To:</td>
<td>
<asp:TextBox ID="txtTo" runat="server" Width="250px"></asp:TextBox>
</td>
</tr>
<tr>
<td>To Email:</td>
<td>
<asp:TextBox ID="txtToEmail" runat="server" Width="250px"></asp:TextBox>
</td>
</tr>
<tr>
<td>Subject:</td>
<td>
<asp:TextBox ID="txtSubject" runat="server" Width="250px"></asp:TextBox>
</td>
</tr>
<tr>
<td>Message:</td>
<td>
<asp:TextBox ID="txtMessage" runat="server" TextMode="MultiLine" Height="138px"
Width="467px"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<asp:Button ID="btnSend" runat="server" Text="Send Email"
onclick="btnSend_Click" />
</td>
</tr>
</table>
<asp:Label ID="Label1" runat="server" ForeColor="Blue" />
</div>
</form>
</body>
</html>
</asp:Content>
In the masterpage you have something like this:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
You only need to have this stripped markup in the content page. Notice that I have removed DOCTYPE, <html>, <head>, <body> and <form> tags from content page - they will be rendered from Site.Master master page.
<%# Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Clips.aspx.cs" Inherits="Clip.Clips" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:EntityDataSource ID="entityDataSource" runat="server" ConnectionString="name=ClipEnt" DefaultContainerName="ClipEnt" EnableDelete="True" EnableFlattening="False" EnableInsert="True" EnableUpdate="True" EntitySetName="Clips" EntityTypeFilter="Clip" OnSelecting="EntityDataSource_Selecting">
</asp:EntityDataSource>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" DataSourceID="entityDataSource">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="True" />
</Columns>
</asp:GridView>
<div>
<h1>Sending Email</h1>
<table>
<tr>
<td>From:</td>
<td>
<asp:TextBox ID="txtFrom" runat="server" Width="250px"></asp:TextBox>
</td>
</tr>
<tr>
<td>From EMail:</td>
<td>
<asp:TextBox ID="txtFromEmail" runat="server" Width="250px"></asp:TextBox>
</td>
</tr>
<tr>
<td>To:</td>
<td>
<asp:TextBox ID="txtTo" runat="server" Width="250px"></asp:TextBox>
</td>
</tr>
<tr>
<td>To Email:</td>
<td>
<asp:TextBox ID="txtToEmail" runat="server" Width="250px"></asp:TextBox>
</td>
</tr>
<tr>
<td>Subject:</td>
<td>
<asp:TextBox ID="txtSubject" runat="server" Width="250px"></asp:TextBox>
</td>
</tr>
<tr>
<td>Message:</td>
<td>
<asp:TextBox ID="txtMessage" runat="server" TextMode="MultiLine" Height="138px"
Width="467px"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<asp:Button ID="btnSend" runat="server" Text="Send Email"
OnClick="btnSend_Click" />
</td>
</tr>
</table>
<asp:Label ID="Label1" runat="server" ForeColor="Blue" />
</div>
</asp:Content>
Some points to remember when developing an asp.net web site -
asp.net web forms can contain only one form tag with the attribute runat='server'. So, when a web form inherits from a masterpage, it inherits the form tag from the master page. therefore, no need to add a form tag separately to the web form.
Common parts of the page should be placed in the master page, where as changing parts should be placed in the web forms that inherit the master page. Site headers and footers are static to every page. so they should be placed on the master page. contents of the web site changes from page to page. so they should be placed on the web forms that inherit the master page.
Links to common resources, i.e. site style sheets and javascript files should also be placed once in the masterpage. web forms that inherit the masterpage will automatically inherit them.
these are some of the things by following which you can easily develop web forms with master pages.
I am trying to put a Label control within a panel control. the panel control is supposed to enable the user scroll down when the label content grows bigger than the panel capacity.
<%# Page Language="C#" AutoEventWireup="true" CodeFile="EventReviewPage.aspx.cs"
Inherits="EventReviewPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Event Log: "></asp:Label>
</td>
<td>
<asp:TextBox ID="txtLog" runat="server"></asp:TextBox>
</td>
<td>
<asp:CheckBox ID="chkAll" runat="server" OnCheckedChanged="chkAll_CheckedChanged"
AutoPostBack="True" />
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="Source: "></asp:Label>
</td>
<td>
<asp:TextBox ID="txtSource" runat="server"></asp:TextBox>
</td>
</tr>
</table>
</div>
<div>
<asp:Button ID="cmdGet" runat="server" Text="Get Records" OnClick="cmdGet_Click" />
</div>
<asp:Panel ID="Panel1" runat="server" BorderStyle="None" ScrollBars="Vertical">
<asp:Label ID="lblResult" runat="server" Text=""></asp:Label>
</asp:Panel>
</form>
</body>
</html>
The asp:Panel warps the text with a div, but you do not have specify a height for this panel, so their height is always fit the height of your data, and thats why you do not see scroll bar for that div.
If you set both height and width you see the scroll bar.
For example
<asp:Panel ID="Panel1" runat="server" BorderStyle="None"
ScrollBars="Vertical" Height="80px" Width="180px">
Morning All,
I am trying to make a web page printer friendly. I have managed to complete this for one of my pages perfectly fine by having another style sheet and the referencing this is my master page.
<link href="Styles/style2.css" rel="stylesheet" type="text/css" />
<link href="styles/style-print.css" media="print" rel="stylesheet" type="text/css" />
The problem that i have is the main page i wish to have a printer friendly option hold is made up of ASP. Panel controls and these also have 1 or 2 subpanels. I used these panels to reduce clutter and scrolling.
If i add the relevant div tags to the main page i seem to only get the headers of these Panels and do not get the sub headings or and the content within these panels unless i collapse these panels before i click the printer friendly button.
This is not a task that i wish the user to complete also the printer friendly page looks horrible as i would like to remove the panel / boxes. Is there a way for me to format this page so i dont get to see the panels but just the content when the users presses the pinter friendly button?
Regards
Betty.
Here is some sample code for my collopsible panels...
<table>
<tr>
<td style="width:528px">
<h5>Topic</h5>
</td>
<td style="width:154px">
<h5>Presenter</h5>
</td>
<td>
<h5>Time</h5>
</td>
</tr>
</table>
<!-- 1. HSE Issues (Main heading) -->
<asp:Panel ID="pnlHeaderHSERegIssues" runat="server" CssClass="pnl"
Width="740px">
<div style="float:left;">
1. Safety, Health, Environmental & Regulatory Issues
</div>
<div style="float:right;">
<asp:Label ID="lblShowHideHSERegIssues" runat="server"></asp:Label>
</div>
<div style="clear:both">
</div>
</asp:Panel>
<!-- 1.1 Safety Sub heading -->
<asp:Panel ID="pnlInfoHSERegIssues" runat="server" CssClass="pnlBody">
<asp:Panel ID="pnlHeaderSafety" runat="server" CssClass="pnlBody2" Width="740px">
<div style="float:left;">
1.1 - Safety Reviews
</div>
<div style="float:right;">
<asp:Label ID="lblShowHideSafety" runat="server"></asp:Label>
</div>
<div style="clear:both">
</div>
</asp:Panel>
<asp:Panel ID="pnlInfoSafety" runat="server" CssClass="pnlBody">
<table width="100%">
<tr>
<td style="width: 510px">
<asp:TextBox ID="txtSafety" runat="server" Height="100px"
style="font-family:Verdana" TextMode="MultiLine" Width="510px"></asp:TextBox>
</td>
<td style="width: 140px" valign="top">
<asp:TextBox ID="txtSafetyPresenter" runat="server" Height="97px"
style="font-family:Verdana" width="140px"></asp:TextBox>
</td>
<td style="width: 57px" valign="top">
<asp:TextBox ID="txtSafetyTime" runat="server" style="font-family:Verdana"
width="50px"></asp:TextBox>
</td>
</tr>
</table>
</asp:Panel>
</asp:Panel>
<!-- Collapse / un-collapse Panels (Main Heading) -->
<asp:CollapsiblePanelExtender ID="CollapsiblePanelExtender" runat="server"
CollapseControlID="pnlHeaderHSERegIssues" Collapsed="true"
CollapsedText="Show Details" ExpandControlID="pnlHeaderHSERegIssues"
ExpandDirection="Vertical" ExpandedText="Hide Details" ScrollContents="false"
TargetControlID="pnlInfoHSERegIssues" TextLabelID="lblShowHideHSERegIssues">
</asp:CollapsiblePanelExtender>
<!-- Collapse / un-collapse Panels (sub Heading) -->
<asp:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" runat="server"
CollapseControlID="pnlHeaderSafety" Collapsed="true" CollapsedText="Show"
ExpandControlID="pnlHeaderSafety" ExpandDirection="Vertical" ExpandedText="Hide"
ScrollContents="false" TargetControlID="pnlInfoSafety"
TextLabelID="lblShowHideSafety">
</asp:CollapsiblePanelExtender>
When the user pushes the Button, I'd like to display a modal dialog box to capture a couple of values from text boxes and submit these values to the server.
When the modal box is shown, I'd like the cursor to be placed in the txtFirst textbox.
How do I do this? I've had trouble with registerscript commands before, so if one is needed, I hope the syntax, if you provide it, is correct.
Thanks
<%# Page Language="VB" AutoEventWireup="false" CodeFile="MyModalSimple.aspx.vb" Inherits="MyModalSimple" %>
<%# Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function onOk() {
form1.submit();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Button ID="Button1" runat="server" Text="Button" />
<cc1:modalpopupextender id="Button1_ModalPopupExtender" runat="server" targetcontrolid="Button1"
popupcontrolid="pnlModal" okcontrolid="btnOK" cancelcontrolid="btnCancel" DropShadow="true" OnOkScript="onOk();">
</cc1:modalpopupextender>
<asp:Panel ID="pnlModal" runat="server" Style="display: None1"
BackColor="#CCCCCC">
<br />
<table>
<tr>
<td>
<asp:Label ID="lblFirst" runat="server" Text="First"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtFirst" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblLast" runat="server" Text="Last"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtLast" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
</td>
<td align="right">
<asp:Button ID="btnOK" runat="server" Text="OK" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" />
</td>
</tr>
</table>
<br />
<br />
</asp:Panel>
</div>
</form>
</body>
</html>
Also, how could I change the above code so that the modal dialog was displayed as a result of a selection of a dropdownlist item? If I set the targetcontrolid="DropDownList1", the dialog box is display when it drops rather than when a selection is made
An example can be found here. In essence you are using javascript.
I know this was already answered, but here's an easier code:
C#:
ScriptManager.RegisterStartupScript(this, this.GetType(), "FocusScript", "setTimeout(function(){$get('" + btnOk.ClientID + "').focus();}, 100);", true);
VB:
ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "FocusScript", "setTimeout(function(){$get('" + btnOk.ClientID + "').focus();}, 100);", True)
Remove Style="display: None1" from control panel
I'm using FCKEditor on my asp.net web page. It appears beautifully, and the editor looks really good on the front end. Only problem is, the .Value property is not being set on the postback. No matter what changes the user makes to the value of the control on the page, when I click "Submit", the .Value property remains blank.
I have Googled for other solutions, and most of them are of the variety where there's some conflict with Ajax, such as this and this. My problem is not solved by these solutions; it's much more fundamental than that. I'm not doing anything to do with Ajax; I'm just a simple asp.net newbie with a simple web form, and the value property is not being set on postback, not in IE and not in FF.
It appears that at least one other person has had this problem, but no solution yet.
Any ideas?
Thanks!
New information:
I tried this out on a "hello world" test web site - and the test web site works 100%. There is obviously a problem on my page, but I have no idea where to begin tracking this down.
Here's the markup of my page, in case anyone can see anything obvious that my newbie eyes can't:
<%# Page Language="vb" AutoEventWireup="false" CodeBehind="EmailTemplateEditForm.aspx.vb"
Inherits="EEI_App.EmailTemplateEditForm" %>
<%# Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>EEI - Email Template</title>
<link rel="stylesheet" href="EEI.css">
<script language="javascript" id="jssembleWare" src="sembleWare.js"></script>
<style type="text/css">
.style1
{
height: 251px;
}
.style2
{
width: 2%;
height: 251px;
}
.style3
{
height: 490px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<%# register src="header.ascx" tagname="header" tagprefix="uc1" %>
<%# register src="footer.ascx" tagname="footer" tagprefix="uc1" %>
<uc1:header ID="header1" runat="server" />
<!-- main content area -->
<div class="content">
<!-- title of the page -->
<div class="boxheader">
Email Template
</div>
<div class="standardbox">
<!-- Start Page Main Contents-->
<!-- error messages -->
<div class="errorbox">
<asp:Label ID="lblError" CssClass="ErrorControlStyle" runat="server" EnableViewState="False"
Width="100%"></asp:Label>
</div>
<table class="contenttable">
<tr>
<td align="left" valign="top" class="style3">
<div class="actionbox">
<div class="navheadertitle">
Navigation</div>
<ul>
<li>
<asp:LinkButton ID="btnSubmit" CssClass="LinkButtonStyle" runat="server">Submit</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="btnCancel" CssClass="LinkButtonStyle" runat="server" CausesValidation="false">Cancel</asp:LinkButton>
</li>
</ul>
</div>
</td>
<td align="left" valign="top" class="style3">
<p>
</p>
<table>
<tr class="MCRSFieldRow">
<td class="MCRSFieldLabelCell">
<asp:Label ID="lblEmailTemplate_TemplateName" CssClass="LabelStyle" runat="server"
Width="175">Template Name</asp:Label>
</td>
<td class="MCRSFieldEditCell">
<asp:TextBox ID="txtEmailTemplate_TemplateName" CssClass="TextBoxStyle" runat="server"
Width="100%"></asp:TextBox>
</td>
<td class="MCRSFieldLabelCell">
<asp:Label ID="lblEmailTemplate_TemplateType" CssClass="LabelStyle" runat="server"
Width="175">Template Type</asp:Label>
</td>
<td class="MCRSFieldEditCell">
<asp:RadioButtonList ID="rblEmailTemplate_TemplateType" CssClass="RadioButtonListStyle"
runat="server" RepeatColumns="1" RepeatDirection="Horizontal" Width="135px">
<asp:ListItem Value="1">Cover Letter</asp:ListItem>
<asp:ListItem Value="2">Email</asp:ListItem>
</asp:RadioButtonList>
</td>
<td class="MCRSRowRightCell">
</td>
</tr>
<tr class="MCRSFieldRow">
<td class="MCRSFieldLabelCell">
Composition Date
</td>
<td class="MCRSFieldEditCell">
<asp:Label ID="lblEmailTemplate_CompositionDate" CssClass="ElementLabelStyle" runat="server"
Width="175"></asp:Label>
</td>
<td class="MCRSFieldLabelCell">
Last Used Date
</td>
<td class="MCRSFieldEditCell">
<asp:Label ID="lblEmailTemplate_LastUsedDate" CssClass="ElementLabelStyle" runat="server"
Width="175"></asp:Label>
</td>
<td class="MCRSRowRightCell">
</td>
</tr>
<tr class="MCRSFieldRow">
<td class="MCRSFieldLabelCell">
Composed By
</td>
<td class="MCRSFieldEditCell" colspan="3">
<asp:Label ID="lblPerson_FirstNames" CssClass="ElementLabelStyle" runat="server"></asp:Label>
<asp:Label ID="lblPerson_LastName" CssClass="ElementLabelStyle" runat="server"></asp:Label>
</td>
<td class="MCRSRowRightCell">
</td>
</tr>
<tr class="MCRSFieldRow">
<td class="MCRSFieldLabelCell">
<asp:Label ID="lblEmailTemplate_Subject" CssClass="LabelStyle" runat="server" Width="175">Subject</asp:Label>
</td>
<td class="MCRSFieldEditCell" colspan="3">
<asp:TextBox ID="txtEmailTemplate_Subject" CssClass="TextBoxStyle" runat="server"
Width="100%"></asp:TextBox>
</td>
<td class="MCRSRowRightCell">
</td>
</tr>
<tr class="MCRSFieldRow">
<td class="style1">
<asp:Label ID="lblEmailTemplate_Body" CssClass="LabelStyle" runat="server" Width="175">Body</asp:Label>
</td>
<td class="style1" colspan="3">
<FCKeditorV2:FCKeditor ID="FCKeditor1" runat="server" Height="500px">
</FCKeditorV2:FCKeditor>
</td>
<td class="style2">
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<p>
<a class="InputButtonStyle" href="#_swTopOfPage">Top of Page</a>
</p>
</div>
<uc1:footer ID="footer1" runat="server" />
<p>
<asp:TextBox ID="txtEmailTemplate_Body" CssClass="TextAreaStyle" Rows="4" runat="server"
Width="100%" Height="16px" Visible="False"></asp:TextBox>
</p>
</form>
</body>
</html>
Problem with getting value from FCKeditor (FCKeditor.Value) at ASP.Net
1. If initial value FCKeditor.Value not set, there is no problem, all values, which are placed to FCKeditor can get with FCKeditor.Value.
2. Problem: if initial value FCKeditor.Value is not null, then if I want get value, it gives me only initial value.
I have solved!!!!
I spent the whole day ... Hardly found the answer.
Specially registered to write a reply!
Look! Example:
// Set initial value to FCKeditor
void Page_Init(object sender, EventArgs e)
{
DataTable dT_01 = new DataTable();
dT_01 = DataLayerMainContent.ArticlesSelect(2);
FCKeditor_Edit.Value = dT_01.Rows[0]["ArticleText"].ToString();
}
Attention!!!
You have not to do this here!!
protected void Page_Load(object sender, EventArgs e)
{
// Not here!!!
}
// And get Value from FCKeditor
protected void Btn_ContentEditedSave_Click(object sender, EventArgs e)
{
//FCKeditor_Edit.Value
// And add this value to DataBase
DataLayerAdminPost.ContentMainEdit(1, FCKeditor_Edit.Value);
Response.Redirect(Request.RawUrl);
}
Main Idea!
Set initial value to FCKeditor at Page_Init!
Have you got ViewState enabled? ANS = Yes
EDIT: OK, then inside the Page_Init event try adding the following:
Page.RegisterRequiresPostBack(FCKeditor1);
The solution above didn't work for me, however i found solution here
Here's code what I used
protected void Page_Load(object sender, EventArgs e)
{
ScriptManager.RegisterOnSubmitStatement(
this,
this.GetType(),
"AjaxHack", "for ( var i = 0; i < parent.frames.length; ++i ) if ( parent.frames[i].FCK ) parent.frames[i].FCK.UpdateLinkedField();");
}
Hope that saves someones day. I was looking for the solution for 2 months.
Cheers