If statement error in aspx page - asp.net

I am doing a product page and I want "You maybe need also these products".
For example if productID is 2 then show me link to productID 5.
I have tried to do it with this:
<% if(Item.ProductID == 2) { %>
<a href="ProductDetails.aspx?productID=5">
<img src="/Catalog/Images/suihkukaappi.png"
width="100" height="75" style="border: solid" /></a>
<% } %>
But it gives me the error "The name 'Item' does not exist in current context." And link works fine if I take this if statement off but the same link is every product page.
Here is my code inside ItemTemplate from aspx page:
<ItemTemplate>
<div>
<h1><%#:Item.ProductName %></h1>
</div>
<br />
<table>
<tr>
<td>
<img src="/Catalog/Images<%#:Item.ImagePath %>" style="border:solid; height:150px; width:175px;" alt="<%#:Item.ProductName %>"/>
</td>
<td> </td>
<td style="vertical-align: top; text-align:left;">
<b>Tuoteselostus:</b><br /><%#:Item.Description %>
<br />
<span><b>Hinta:</b> <%#: String.Format("{0:c}", Item.UnitPrice) %></span>
<br />
<span><b>Tuotenumero:</b> <%#:Item.ProductID %></span>
<br />
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<% if(Item.ProductID == 2) { %>
<a href="ProductDetails.aspx?productID=5">
<img src="/Catalog/Images/suihkukaappi.png"
width="100" height="75" style="border: solid" />
</a>
<% } %>
</td>
</tr>
</table>
</ItemTemplate>

Try using Container.DataItem and cast it to the corresponding model that you are iterating over:
<% if(((Product)Container.DataItem).ProductID == 2) { %>

Related

Using Repeater control in vb.net

I am using a repeater control to view database table data, I want to add a link button next to each row to delete a specific row, how can I do that using vb.net??
There is nothing to do much, do you want to display it(link button for all the rows? if yes then try the following code)
<table cellpadding="0" cellspacing="0">
<tr valign="top" class="list_heading">
<td width="25%">
Column
</td>
<td width="25%">
Operation
</td>
<td width="19%" style="display: none;">
And/Or
</td>
<td width="25%">
Value
</td>
<td width="06%">
Remove
</td>
</tr>
<tbody>
<asp:Repeater ID="rpSearchItems" runat="server">
<ItemTemplate>
<tr>
<td style="display: none;">
</td>
<td>
<%# Eval("ColumnName") %>
</td>
<td>
<%# Eval("Operation") %>
</td>
<td style="display: none;">
<%# Eval("AndOr") %>
</td>
<td>
<%# Eval("Value") %>
</td>
<td align="center">
<asp:ImageButton ID="ibtnRemoveSearchItem" ImageUrl="~/Controls/ImagesForSearch/Remove.png"
CommandArgument=' <%# Eval("Id") %>' CssClass="RemoveUitem" ToolTip="Remove Item"
runat="server" OnClick="ibtnRemoveSearchItem_Click" />
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</tbody>
<tr valign="top" class="list_bottom">
<td colspan="6">
</td>
</tr>
</table>
And in code behind code you can go like this:
Protected Sub ibtnRemoveSearchItem_Click(sender As Object, e As EventArgs)
ImageButton ibtnRemoveSearchItem = (ImageButton)sender;
Int32 Id = Convert.ToInt32(ibtnRemoveSearchItem.CommandArgument);
//Using the above two lines you can get the Coomand Argument, pass it to you delete stored proc thats all
// do your stuff here
End Sub
hope this will help you
UPDATE : If you want to add it conditionally then you can do it from "OnItemDataBound" event of repeater
for much info review this
This one also can help you

IE 8 not displaying page

My page is not displaying in IE8. It works fine if I debug in IE and change it to IE7 standards under Internet Explorer 8 browser mode. I'm not sure what is wrong. If I add a meta tag with IE7 specified, it loads the page, and then looks like it forwards it to a blank page. All of the html is there in the debug information, and it works fine in IE7 browser mode, or in Firefox. Any ideas? Here is my header:
Master Page:
<%# Master Language="C#" AutoEventWireup="true" CodeFile="Site2.master.cs" Inherits="Site2" %>
<%# Register TagPrefix="uc" TagName="Header" Src="~/Controls/Header.ascx" %>
<%# Register TagPrefix="uc" TagName="Footer" Src="~/Controls/Footer.ascx" %>
<!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 id="Head1" runat="server">
<title></title>
<link href="Styles/Site.css" rel="Stylesheet" type="text/css" />
<script src="<%= ResolveClientUrl("Scripts/jquery-1.4.1.js") %>" type="text/javascript" > </script>
<script src="<%= ResolveClientUrl("Scripts/Jquery.min.js") %>" type="text/javascript" > </script>
<script src="<%= ResolveClientUrl("Scripts/menu.js") %>" language="javascript" type="text/javascript" > </script>
<script src="<%= ResolveClientUrl("Scripts/jquery-ui-1.8.10.custom.min.js") %>" type="text/javascript" > </script>
<script src="<%= ResolveClientUrl("Scripts/EasyConfirm.js") %>" type="text/javascript" > </script>
<link href="<%= ResolveClientUrl("Styles/jquerySmoothness.css") %>" rel="stylesheet" type="text/css" />
</head>
<body >
<form id="form1" runat="server" enctype="multipart/form-data" method ="post" >
<asp:ScriptManager ID="ScriptManager1" AjaxFrameworkMode="Enabled" EnablePartialRendering="true" runat="server" />
<div class="container">
<uc:Header runat="server" ID="headerTest" Title="RTSC SCM" Subtitle="Logistics SOS" />
<div class="content2 " style ="position:relative; padding-bottom: 10px" >
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server"/>
<%--</asp:ContentPlaceHolder>--%>
<!-- end .content --></div>
<uc:Footer runat="server" ID="footer" TeamName="RTSC Logistics SOS Tool Support Team" />
<!-- end .container --></div>
</form>
</body>
</html>
Page:
<%# Page Title="RTSC SOS - Storage Request View" Language="C#" MasterPageFile="~/Site2.master" AutoEventWireup="true" CodeFile="StorageRequest.aspx.cs" Inherits="Forms_StorageRequest" ContentType="IE7" %>
<%# Register TagPrefix="uc" TagName="EmployeeSearch" Src="~/Controls/TinyEmployeeSearch.ascx" %>
<%# Register Src="~/Controls/AdditionalInfo.ascx" TagPrefix="R" TagName="AddInfo" %>
<%# Register Src="~/Controls/LamEditComments.ascx" TagPrefix="R" TagName="StorageLocation" %>
<%# Register Src="~/Controls/RequestHeader.ascx" TagPrefix="R" TagName="reqheader" %>
<%# Register Src="~/Controls/HandlingUnitInfo.ascx" TagPrefix="R" TagName="handlingView" %>
<%# Register Src="~/Controls/DocumentGrid.ascx" TagPrefix="R" TagName="docView" %>
<%# Register Src="~/Controls/EmailGrid.ascx" TagPrefix="R" TagName="emailView" %>
<%# Register src="~/Controls/RequestInfo.ascx" tagname="requestinfo" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<script type ="text/javascript" src="../Forms/FormsJS/StorageRequest.js"></script>
<script type ="text/javascript" src="../Scripts/ajaxfileupload.js"></script>
<div id="input" runat ="server" style="width: 960px" >
<R:reqheader id="m_reqHeaderCtr" runat="server" />
<r:docView ID="docView" runat="server" Visible = "true" />
<r:emailView ID="emailView" runat="server" Visible = "true"/>
<uc1:requestinfo ID="requestinfo1" runat="server" Visible = "false" />
<%-- Request Edit Information --%>
<fieldset id="RequestEdit" runat ="server" style="border-color: #CCC; width: 960px;" >
<legend style="border-style: none;font-size:small; color: Blue;">Request Information</legend>
<div style="margin: 0px; padding: 0px; float:left" >
<table>
<tr style="height: 25px;">
<td class ="BDecoNone bold" width="60px">
<img id="star1" runat ="server" src="../Images/red_star.gif" alt="Red Star" class="RedStars"/> Program:
</td>
<td width="120px">
<asp:DropDownList ID="strgProg_DD" Height="20px" runat="server" AutoPostBack="false" CssClass="TBDecoSmall">
</asp:DropDownList>
<span id="Program_Span" runat="server" />
</td>
<td runat="server" id="Other_TR" class="bold" style="text-align:right;display:none;">
<img id="star3" runat ="server" src="../Images/red_star.gif" alt="red_star" class="RedStars" />
<asp:Label ID="OtherTD" Text = "Other Program:" Width = "73px" runat ="server" ></asp:Label>
</td>
<td width="100px">
<asp:TextBox ID="m_otherProgramTB" runat="server" CssClass="TBDecoNone" ViewStateMode="Enabled" Height="12px" Wrap="False"></asp:TextBox>
</td>
<td width="100px">
</td>
</tr>
</table>
<table>
<tr>
<td class="bold TBDecoSmall " >
<img id="star4" runat ="server" src="../Images/red_star.gif" alt="Red Star" class="RedStars"/>Ownership:
</td>
<td colspan="1">
<span id="m_ownershipSpan" runat="server" class="bold" />
<asp:RadioButtonList ID="OwnRadioButtonList" runat="server" CssClass="bold" RepeatColumns="5" RepeatDirection="Horizontal"></asp:RadioButtonList>
</td>
<td>
</td>
</tr>
</table>
<table>
<tr>
<td class="bold TBDecoQuan" style ="width:150px">
<img id="star5" runat ="server" src="../Images/red_star.gif" alt="Red Star" class="RedStars"/>Check to Certify:
</td>
<td colspan="1">
<span ID="Material_CB_Span" runat="server"></span>
<asp:CheckBox ID="Material_CB" runat="server" AutoPostBack="false" CssClass="cb bold" Text="Material is NOT Classified" Width="150px" />
</td>
</tr>
</table>
<table>
<tr>
<td class="bold TBDecoSmall" style="width: 150px; height: 24px;">
<img id="star6" runat ="server" src="../Images/red_star.gif" alt="Red Star" class="RedStars"/>Storage Requirements:
</td>
<td colspan="1" style="height: 24px">
<asp:CheckBoxList ID="m_storageList" runat="server" AutoPostBack="false" CssClass="Space bold" RepeatColumns="5" />
</td>
</tr>
</table>
<table>
<tr ID="TempStorageInstruction_TR" runat="server" >
<td class="bold TBDecoSmall" colspan="1" style="width: 180px">
<img id="star7" runat ="server" src="../Images/red_star.gif" alt="Red Star" class="RedStars"/>Temperature Storage Instructions:
</td>
<td >
<span ID="TempStorageSpan" runat="server" class="bold"></span>
<asp:TextBox ID="TempStorageInstruction_TB" runat="server" CssClass="Bmar TBDecoLong" ValidationGroup="saveAll" ViewStateMode="Enabled" Height="20px" TextMode="MultiLine" Width="220px"></asp:TextBox>
</td>
<td>
</td>
</tr>
<tr ID="OtherStorageInstruction_TR" runat="server" >
<td class="bold TBDecoSmall" style="width: 150px">
<img id="star8" runat ="server" src="../Images/red_star.gif" alt="Red Star" class="RedStars"/> Other Storage Instructions:
</td>
<td >
<span ID="m_otherInstSpan" runat="server" class="bold"></span>
<asp:TextBox ID="OtherStorageInstruction_TB" runat="server" CssClass="Bmar TBDecoLong" Height="20px"
TextMode="MultiLine" ValidationGroup="saveAll" ViewStateMode="Enabled" Width="220px"></asp:TextBox>
</td>
<td>
</td>
</tr>
</table>
</div>
<div style="position: relative; width: 360px; float: right; height: auto; padding-top: 5px; top: 0px;" >
<div class="TBDecoNone" style ="padding: 0x; margin: 0px; float: left" >
<img id="star2" runat ="server" src="../Images/red_star.gif" alt="Red Star" class="RedStars"/> Program Point of Contact:
</div>
<div style ="float : left">
<uc:employeesearch id="progrmPointOfContact_TB" runat="server" scheme="Red" Enabled="false" />
</div>
</div>
</fieldset>
<fieldset runat="server" id ="EditGrid" style="border-color: #CCC; width: 960px;">
<legend style="border-style: none;font-size:small; color: Blue;">
Handling Unit Information</legend>
<div id="GridHolder">
<R:handlingView ID="handlingViewGrid" runat="server" Visible = "true" />
<br />
</div>
<div>
<input type="button" id="m_addNewItem" value="Add Material" style="border-color:#87BF83;color:Black" class="AddB" onclick="AddMaterial()" />
</div>
<div id="m_detailsView" runat="server" style="display:none">
<table cellpadding="1" cellspacing="1">
<tr>
<td class="TextDeco"><img src="../Images/red_star.gif" alt="red_star" class="RedStars"/>Material Number:</td>
<td class="TextDeco"><img src="../Images/red_star.gif" alt="red_star" class="RedStars"/>Description: </td>
<td class="TextDeco"> Manufacturer:</td>
<td class="TextDeco"> Model:</td>
</tr>
<!-- End Header section-->
<tr style="height: 20px; vertical-align: top;">
<!--Material TextBox ID=MatNum_TB-->
<td>
<asp:TextBox ID="MatNum_TB" runat="server" CssClass="TBDeco" Width="175px" Wrap="False"></asp:TextBox>
<br />
</td>
<!--Description TextBox-->
<td>
<asp:TextBox ID="Des_TB" runat="server" CssClass="TBDeco" Width="175px" Wrap="False"></asp:TextBox>
</td>
<!--Manufacturer TextBox-->
<td class="TBDeco">
<asp:TextBox ID="Manufac_TB" runat="server" CssClass="TBDeco" Width="250px" Wrap="False"></asp:TextBox>
<br />
</td>
<!--Model TextBox-->
<td>
<asp:TextBox ID="Model_TB" runat="server" CssClass="TBDeco" Wrap="False" Width="100px"></asp:TextBox>
<br />
</td>
</tr>
<tr>
<td class="TextDeco">
<img src="../Images/red_star.gif" alt="red_star" class="RedStars"/>Material Type:
</td>
<td class="TextDeco" style ="width:150px">
<img src="../Images/red_star.gif" class="RedStars" alt="red_star"/>Inv. Classification:
</td>
<td class="TextDeco" >
<img src="../Images/red_star.gif" alt="red_star" class="RedStars"/>Shelf-Life:
</td>
<td class="TextDeco" >
</td>
</tr>
<tr valign="top">
<td>
<!--Material Type DropDownList-->
<asp:DropDownList ID="MatType_DD" Height="20px" runat="server" CssClass="TBDeco" Width="150px" ></asp:DropDownList>
<br />
</td>
<!--Inventory DropDownList-->
<td>
<asp:DropDownList ID="Inv_DD" Height="20px" runat="server" CssClass="TBDeco" Width="150px"></asp:DropDownList>
<br />
</td>
<td width="240px">
<div style="float: left; height: 20px auto; width: 130px;" >
<asp:TextBox ID="SLife_TB" runat="server" CssClass="TBDecoSmall" Wrap="False" Width="120px" onclick="document.getElementById('ContentPlaceHolder2_SLife_TB').focus();"></asp:TextBox>
<br />
</div>
<div style="float:right; height: 20px auto;" >
<asp:CheckBox ID="Unlimit_CB" runat="server" AutoPostBack="false" CssClass="TBDecoSmall" Height="20px" Text="Unlimited" />
</div>
</td>
</tr>
<!--Header-->
<tr>
<td class="TextDeco">
<img src="../Images/red_star.gif" alt="red_star" class="RedStars"/>Charge Number:
</td>
<td class="TextDeco" style="margin-left:15px;">
Owning Cost Center:
</td>
<td class="TextDeco" style="margin-left:15px;">
Unit Value:
</td>
</tr>
<tr class="bold" style="vertical-align: top">
<!--Charge Number TextBox-->
<td width="250px">
<asp:TextBox ID="Charge_TB" runat="server" CssClass="TBDeco" Width="143px"></asp:TextBox>
<br />
</td>
<!--Owning Cost Center TextBox-->
<td>
<asp:TextBox ID="Own_TB" runat="server" CssClass="TBDeco" Width="143px"></asp:TextBox>
<br />
</td>
<td>
<asp:TextBox ID="Line_TB" runat="server" CssClass="TBDeco" Width="120px"></asp:TextBox>
<br /><br />
</td>
</tr>
</table>
<table cellpadding="1" cellspacing="1" rules="none" frame="void" style="margin: 0px; padding: 0px" >
<tr class="bold ">
<td width="108px">
<img src="../Images/red_star.gif" alt="red_star" class="RedStars" />Serialized:
</td>
<td width="60px" >
<asp:RadioButtonList ID="Seri_RB" runat="server" RepeatDirection="Horizontal" AutoPostBack="false" Width="80px" >
<asp:ListItem Value="1">Yes</asp:ListItem>
<asp:ListItem Value="0">No</asp:ListItem>
</asp:RadioButtonList>
</td>
<td width="193px">
<img id="starForQuantity" runat ="server" src="../Images/red_star.gif" alt="Red Star" class="RedStars"/> Quantity:
<br />
<asp:TextBox ID="Quan_TB" runat="server" Width="143px" Wrap="False" CssClass="TBDecoNone"></asp:TextBox>
</td>
<td width="300px" id="SerialNumber" runat ="server" >
<img id="starForSerial" runat ="server" src="../Images/red_star.gif" alt="Red Star" class="RedStars"/> Serial Number:
<br />
<asp:TextBox ID="Seri_TB" runat="server" Width="120px" CssClass="TBDecoNone" Wrap ="false" ></asp:TextBox>
</td>
</tr>
<tr class="bold " >
<td>
<img src="../Images/red_star.gif" alt="red_star" class="RedStars"/>Moisture Sensitive:
</td>
<td width="60px">
<asp:RadioButtonList ID="Moist_RB" runat="server" AutoPostBack="false" RepeatDirection="Horizontal" >
<asp:ListItem Value="1">Yes</asp:ListItem>
<asp:ListItem Value="0">No</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr class="bold " >
<td >
<img src="../Images/red_star.gif" alt="red_star" class="RedStars"/>Hazardous:
</td>
<td width="80px">
<asp:RadioButtonList ID="Haz_RB" runat="server" RepeatDirection="Horizontal" AutoPostBack="false" >
<asp:ListItem Value="1">Yes</asp:ListItem>
<asp:ListItem Value="0">No</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
</table>
<table>
<tr class="bold" runat="server" id="MSDS_TR" style="display:none">
<td width="130px;">
<img src="../Images/red_star.gif" alt="red_star" class="RedStars"/>
<asp:Label ID="MSDSLabel" runat="server" Text="MSDS Number:"></asp:Label>
</td>
<td width="100px">
<asp:TextBox ID="MSDS_TB" runat="server" CssClass="TBDecoSmall" Wrap="False" Width="100px"></asp:TextBox>
</td>
<td></td>
<td width="440px" colspan="1" >
<div style="float:left" > Attached MSDS: </div>
<input type="file" id="MSDSFileUpload" runat="server" style="width:330px;height:20px" />
</td>
</tr>
</table>
<table id="pkg" runat ="server" >
<tr class="bold" >
<%-- Pack_TR is to make the red star image visible/invisible--%>
<td runat="server" id="Pack_TR" visible="true" >
<img src="../Images/red_star.gif" alt="red_star" class="RedStars"/>Packaging Requirement:
</td>
<td colspan="3" style="width: 468px; text-align:left;" align="left">
<asp:CheckBoxList ID="PackingReq_CBL" runat="server" AutoPostBack="false"
CssClass="Space" RepeatDirection="Horizontal" Visible="true" />
</td>
</tr>
</table>
<table id ="pkgOther" runat ="server" style="display:none">
<tr id="OtherPkgRequirent_TR" runat="server" class="bold " style ="vertical-align:middle;" >
<td>
<img src="../Images/red_star.gif" alt="red_star" class="RedStars"/>Other Packaging Requirement:
</td>
<td colspan="2" align="left">
<asp:TextBox ID="OtherPkgRequirent_TB" runat="server" Width="550px" Wrap="False"></asp:TextBox>
</td>
<td>
</td>
</tr>
</table>
<center>
<div id="mat_err" style="color:red" runat="server" ></div>
<div style="">
<input type="button" id="btnSave" value="Save Material Number" onclick="return SaveMaterialData();" />
<input type="button" id="btnSaveAddMaterial" value="Save and Add Material Number" />
<input type="button" id="btnCancel" value="Cancel" onclick="Cancel()" />
</div>
</center>
</div>
</fieldset>
</div>
</asp:Content>
Have you tried running it through the XHTML validator?
http://validator.w3.org/
you may find errors in there that are compromising the rest of the page's html.

ModalPopup Not Showing in ASP.Net

I've done everything. Deleted the code and dragged new controls from the toolbox, renamed, tried from javascript -- I just can't get this freakin' modalpopupextender to show. Wasted 3 days.
I'm trying to show it via VB code-behind in the on-click even of the login button. Everything else executes in the button's code, just not this line:
Me.ModalPopupExtender2.Show()
But no matter what I try, it likes to stay hidden.
Any ideas would be welcome!!! Thanks,
Jason
PS -- here's the aspx coding
<%# Page Language="vb" AutoEventWireup="false" CodeBehind="Login.aspx.vb" Inherits="LetterWriterASP.Login" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head id="Head2"><meta http-equiv="Expires" content="-1" /><title>
Anchor General Insurance Agency, Inc.
</title><meta http-equiv="Expires" content="-1" /><link rel="shortcut icon" href="Images/favicon.ico" /><link href="App_Themes/Default/Calendar.css" type="text/css" rel="stylesheet" /><link href="App_Themes/Default/Default.css" type="text/css" rel="stylesheet" />
</head>
<style type="text/css">
.ModalPopupBG
{
background-color: #666699;
filter: alpha(opacity=50);
opacity: 0.7;
}
.HellowWorldPopup
{
min-width:200px;
min-height:100px;
background:white;
border-color:Silver;
border-style:ridge;
border-width:medium;
}
.HeaderStyle
{
color:Black;
background-color:Black;
border-style:solid;
}
.PopupHeader
{
color:Black;
background-color: Black;
}
</style>
<body leftmargin="0" topmargin="0"
background="Images/tile-grey-stripe.jpg">
<form id="Form1" runat="server">
<table width="1000" height="99" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="35" background="../Images/a_ag01.jpg"></td>
<td width="524"><img src="Images/a_ag1.jpg" alt="" width="524" height="99" border="0" align="top" /></td>
<td width="389">
<table border="0" cellspacing="0" cellpadding="0" width="389">
<tr>
<td width="218"><img id="imgHeader" src="Images/text_title_producer1.jpg" style="height:99px;width:218px;border-width:0px;" /></td>
<td width="111"><img id="imgHeadr2" src="Images/text_title-TILE.jpg" style="height:99px;width:171px;border-width:0px;" /></td>
</tr>
</table>
</td>
<td width="19" align="right"><img src="Images/a_ag4_end.jpg" width="19" height="99" alt="" /></td>
<td align="right" width="33" background="Images/a_ag5.jpg"></td>
</tr>
</table>
<!--end of the header table -->
<table height="702" width="1000" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="50" background="Images/b_ag1_lefttile.jpg"> <!-- This is the left wall of the form !-->
</td>
<td width="900" valign="top" bgcolor="#FFFFFF">
<!-- Text, controls, buttons, etc goes below this comment. !-->
<script type="text/javascript">
function InvalidLogin()
{
alert("Invalid user name or password. Please try again.");
window.location = "../Login.aspx";
}
function ShowModal()
{$find('ModalPopupExtender2').show();}
</script>
<br /><br /><br /><br /><br /><br /><br />
<center><table border="2" cellpadding="4" cellspacing="0"
style="border-collapse:collapse;">
<tr>
<td>
<table border="0" cellpadding="0" style="height:172px;width:278px;">
<tr>
<td align="center" colspan="2"
style="color:White;background-color:#5D7B9D;font-size:0.9em;font-weight:bold;">
Log In</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User
Name:</asp:Label>
</td>
<td>
<asp:TextBox ID="UserName" Width="150" name="UserName" runat="server" Font-Size="0.8em"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server"
ControlToValidate="UserName" ErrorMessage="User Name is required."
ToolTip="User Name is required." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>
</td>
<td>
<asp:TextBox ID="Password" Width="150" runat="server" Font-Size="0.8em" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server"
ControlToValidate="Password" ErrorMessage="Password is required."
ToolTip="Password is required." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="center" colspan="2" style="color:Red;">
<asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Button ID="LoginButton" runat="server" BackColor="#FFFBFF"
BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" CommandName="Login"
Font-Names="Verdana" Font-Size="0.8em" ForeColor="#284775"
onclick="LoginButton_Click1" Text="Log In" ValidationGroup="Login1" />
</td>
</tr>
</table>
</td>
</tr>
</table> </center>
<!-- Text, controls, buttons, etc goes above this comment. !-->
<!--"#E6E2D8" "Black"-->
</td>
<td width="50" background="Images/b_ag1_righttile.jpg"> <!-- This is the right wall !-->
</td>
</tr>
</table>
<!--end of content table -->
<table height="75" width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="80" background="Images/c_ag1_leftcorner.jpg"></td>
<td width="840" align="center" valign="top" background="Images/c_ag1_center-piece.jpg" class="contents">
<span id="lblFooter"><center>Copyright © 2006 Anchor General Insurance Agency, Inc. All rights reserved. <br />For questions, please call: (800) 542-6246</center></span>
</td>
<td width="80" background="Images/c_ag1_rightcorner.jpg"></td>
</tr>
</table>
<!-- Popup Form -->
<asp:ToolkitScriptManager ID="ToolkitScriptManager2" runat="server" EnablePageMethods="true">
</asp:ToolkitScriptManager>
<asp:button id="Button3" name="Button3" runat="server" text="Button" style="display: none;" />
<asp:ModalPopupExtender ID="ModalPopupExtender2" runat="server"
targetcontrolid="Button3" popupcontrolid="PopupPanel"
popupdraghandlecontrolid="PopupHeader2" drag="true"
backgroundcssclass="ModalPopupBG">
</asp:ModalPopupExtender>
<asp:Panel ID="PopupPanel" style="display: none" runat="server">
<div class="HellowWorldPopup">
<div class="PopupHeader" id="PopupHeader2"> </div>
<div class="Controls">
<center><table border=0 cellpadding=0 cellspacing=0><tr><td><img src="Images/ajax-loader.gif" /></td><td> Please Wait...</td></tr></table></center>
</div>
</div>
</asp:Panel>
</form>
</body>
</html>
Come to find out (after a VERY long process of trial and error), there's a little something everybody should know about.
You cannot copy
<ToolkitScriptManager>
code from one aspx page to another. You MUST drag it from the toolbox onto your page. I guess it does some stuff we don't see or know about. Same probably goes for ModalPopupExtender.
Hope that helps somebody out there!

Not getting value in javascript

I have a datalist and in itemdatabound iam calling javascript and passing one argument.But iam not getting that argument in js.
<asp:Button ID="btnUpload" runat="server" cssClass="button1" Text="Upload" >
<asp:DataList ID="dlView" runat="server" >
<ItemTemplate>
<tr>
<td>
<asp:Image ID="imgPlan" runat="server" ImageUrl='<%#GetImage(Eval("ImageName")) %>' />
</td>
</tr>
<tr>
<td>
<asp:LinkButton ID="lnkChangeLogo" runat="server" Text="ChangeLogo" OnClientClick="javascript:showLayerUpLoad();return false;">
</asp:LinkButton>
<br />
<asp:LinkButton ID="lnkRemoveLogo" runat="server" Text="RemoveLogo" OnClientClick="javascript:ConfirmChoice();return false;"/>
<asp:TextBox ID="txtImage" runat="server" Text='<%#Eval("ImageName") %>'></asp:TextBox>
<asp:HiddenField ID="hdnImage" runat="server" Value='<%#Eval("ImageName")%>' />
</td>
</tr>
</ItemTemplate>
</asp:DataList>
In itemdatabound i have written following code
Protected Sub dlView_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles dlView.ItemDataBound
If e.Item.ItemType = ListItemType.Item Or _
e.Item.ItemType = ListItemType.AlternatingItem Then
Dim txtImage As TextBox = DirectCast(e.Item.FindControl("txtImage"), TextBox)
Dim s As String = txtImage.Text
btnUpload.OnClientClick = String.Format("javascript:UploadImages('{0}')", s)
End If
End Sub
Following is my javascript fn
function UploadImages(str)
{
alert(str);
}
Problem is in itemdatabound iam getting value in String.Format("javascript:UploadImages('{0}')", s)
but when clicking on btnUpload ,control is moving to UploadImages in js,but no value in str.
What may be the reason for that?Can anybody help please?
Following is html result
<link href="../CSS/PopupDiv.css" rel="stylesheet" type="text/css" /></head>
<div id="shadow" class="opaqueLayer"> </div>
<div id="question" class="questionLayer">
<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#F1ECDE">
<tr style="height:17">
<td style="background:url(../App_Images/bg/contentlefttop.gif)" width="26" height="17"> </td>
<td style="background:url(../App_Images/bg/contenttop.gif)"> </td>
<td style="background:url(../App_Images/bg/contentrighttop.gif)" width="26" height="17"> </td>
</tr>
<tr>
<td style="background:url(../App_Images/bg/contentleft.gif)" width="26"> </td>
<td bgcolor="#FFFFFF">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td style="text-align:justify; line-height:18px">
<img src="../App_Images/loading.gif" alt="Loading..."/>
</td>
</tr>
<tr>
<td>
Please Wait While the Values Load...
</td>
</tr>
</table>
</td>
<td style="background:url(../App_Images/bg/contentright.gif)" width="26"> </td>
</tr>
<tr style="height:17">
<td style="background:url(../App_Images/bg/contentleftbottom.gif)" width="26" height="17"> </td>
<td style="background:url(../App_Images/bg/contentbottom.gif)"> </td>
<td style="background:url(../App_Images/bg/contentrightbottom.gif)" width="26" height="17"> </td>
</tr>
</table>
</div>
<div id="questionUpLoad" class="questionLayer">
<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#F1ECDE">
<tr style="height:17">
<td style="background:url(../App_Images/bg/contentlefttop.gif)" width="26" height="17"> </td>
<td style="background:url(../App_Images/bg/contenttop.gif)"> </td>
<td style="background:url(../App_Images/bg/contentrighttop.gif)" width="26" height="17"> </td>
</tr>
<tr>
<td style="background:url(../App_Images/bg/contentleft.gif)" width="26"> </td>
<td bgcolor="#FFFFFF">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td style="text-align:justify; line-height:18px">
<strong> File Name:</strong><br />
<span id="spnUpload">
<input type="file" id="flUpload" />
</span>
</td>
</tr>
<tr>
<td>
<input type="submit" name="btnUpload" value="Upload" onclick="UploadImages('');" id="btnUpload" class="button1" />
<input type="submit" name="btnCancel" value="Cancel" onclick="javascript:hideLayerUpLoad();return false;" id="btnCancel" class="button1" />
</td>
</tr>
</table>
</td>
<td style="background:url(../App_Images/bg/contentright.gif)" width="26"> </td>
</tr>
<tr style="height:17">
<td style="background:url(../App_Images/bg/contentleftbottom.gif)" width="26" height="17"> </td>
<td style="background:url(../App_Images/bg/contentbottom.gif)"> </td>
<td style="background:url(../App_Images/bg/contentrightbottom.gif)" width="26" height="17"> </td>
</tr>
</table>
</div>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td rowspan="6" colspan="2" align="left" style="padding-right:5px; width: 125px;" >
<table id="dlView" cellspacing="0" border="0" style="border-collapse:collapse;">
<tr>
<td>
<tr>
<td>
<img id="dlView_ctl00_imgPlan" src="../SiteImages/vidhya/40/1/ThumbNails/abc.jpg" style="border-width:0px;" />
</td>
</tr>
<tr>
<td>
<a onclick="javascript:showLayerUpLoad();return false;" id="dlView_ctl00_lnkChangeLogo" href="javascript:__doPostBack('dlView$ctl00$lnkChangeLogo','')">ChangeLogo</a>
<br />
<a onclick="javascript:ConfirmChoice();return false;" id="dlView_ctl00_lnkRemoveLogo" href="javascript:__doPostBack('dlView$ctl00$lnkRemoveLogo','')">RemoveLogo</a>
<input name="dlView$ctl00$txtImage" type="text" value="abc.jpg" id="dlView_ctl00_txtImage" />
<input type="hidden" name="dlView$ctl00$hdnImage" id="dlView_ctl00_hdnImage" value="abc.jpg" />
</td>
</tr>
</td>
</tr><tr>
<td>
<tr>
<td>
<img id="dlView_ctl01_imgPlan" src="../SiteImages/vidhya/40/1/ThumbNails/qwe.DIhJfEPC" style="border-width:0px;" />
</td>
</tr>
<tr>
<td>
<a onclick="javascript:showLayerUpLoad();return false;" id="dlView_ctl01_lnkChangeLogo" href="javascript:__doPostBack('dlView$ctl01$lnkChangeLogo','')">ChangeLogo</a>
<br />
<a onclick="javascript:ConfirmChoice();return false;" id="dlView_ctl01_lnkRemoveLogo" href="javascript:__doPostBack('dlView$ctl01$lnkRemoveLogo','')">RemoveLogo</a>
<input name="dlView$ctl01$txtImage" type="text" value="qwe.DIhJfEPC" id="dlView_ctl01_txtImage" />
<input type="hidden" name="dlView$ctl01$hdnImage" id="dlView_ctl01_hdnImage" value="qwe.DIhJfEPC" />
</td>
</tr>
</td>
</tr><tr>
<td>
<tr>
<td>
<img id="dlView_ctl02_imgPlan" src="../SiteImages/vidhya/40/1/ThumbNails/asd.jpg" style="border-width:0px;" />
</td>
</tr>
<tr>
<td>
<a onclick="javascript:showLayerUpLoad();return false;" id="dlView_ctl02_lnkChangeLogo" href="javascript:__doPostBack('dlView$ctl02$lnkChangeLogo','')">ChangeLogo</a>
<br />
<a onclick="javascript:ConfirmChoice();return false;" id="dlView_ctl02_lnkRemoveLogo" href="javascript:__doPostBack('dlView$ctl02$lnkRemoveLogo','')">RemoveLogo</a>
<input name="dlView$ctl02$txtImage" type="text" value="asd.jpg" id="dlView_ctl02_txtImage" />
<input type="hidden" name="dlView$ctl02$hdnImage" id="dlView_ctl02_hdnImage" value="asd.jpg" />
</td>
</tr>
</td>
</tr><tr>
<td>
<tr>
<td>
<img id="dlView_ctl03_imgPlan" src="../SiteImages/vidhya/40/1/ThumbNails/vini.jpg" style="border-width:0px;" />
</td>
</tr>
<tr>
<td>
<a onclick="javascript:showLayerUpLoad();return false;" id="dlView_ctl03_lnkChangeLogo" href="javascript:__doPostBack('dlView$ctl03$lnkChangeLogo','')">ChangeLogo</a>
<br />
<a onclick="javascript:ConfirmChoice();return false;" id="dlView_ctl03_lnkRemoveLogo" href="javascript:__doPostBack('dlView$ctl03$lnkRemoveLogo','')">RemoveLogo</a>
<input name="dlView$ctl03$txtImage" type="text" value="vini.jpg" id="dlView_ctl03_txtImage" />
<input type="hidden" name="dlView$ctl03$hdnImage" id="dlView_ctl03_hdnImage" value="vini.jpg" />
</td>
</tr>
</td>
</tr><tr>
<td>
<tr>
<td>
<img id="dlView_ctl04_imgPlan" src="../SiteImages/vidhya/40/1/ThumbNails/" style="border-width:0px;" />
</td>
</tr>
<tr>
<td>
<a onclick="javascript:showLayerUpLoad();return false;" id="dlView_ctl04_lnkChangeLogo" href="javascript:__doPostBack('dlView$ctl04$lnkChangeLogo','')">ChangeLogo</a>
<br />
<a onclick="javascript:ConfirmChoice();return false;" id="dlView_ctl04_lnkRemoveLogo" href="javascript:__doPostBack('dlView$ctl04$lnkRemoveLogo','')">RemoveLogo</a>
<input name="dlView$ctl04$txtImage" type="text" id="dlView_ctl04_txtImage" />
<input type="hidden" name="dlView$ctl04$hdnImage" id="dlView_ctl04_hdnImage" />
</td>
</tr>
</td>
</tr><tr>
<td>
<tr>
<td>
<img id="dlView_ctl05_imgPlan" src="../SiteImages/vidhya/40/1/ThumbNails/adf.jpg" style="border-width:0px;" />
</td>
</tr>
<tr>
<td>
<a onclick="javascript:showLayerUpLoad();return false;" id="dlView_ctl05_lnkChangeLogo" href="javascript:__doPostBack('dlView$ctl05$lnkChangeLogo','')">ChangeLogo</a>
<br />
<a onclick="javascript:ConfirmChoice();return false;" id="dlView_ctl05_lnkRemoveLogo" href="javascript:__doPostBack('dlView$ctl05$lnkRemoveLogo','')">RemoveLogo</a>
<input name="dlView$ctl05$txtImage" type="text" value="adf.jpg" id="dlView_ctl05_txtImage" />
<input type="hidden" name="dlView$ctl05$hdnImage" id="dlView_ctl05_hdnImage" value="adf.jpg" />
</td>
</tr>
</td>
</tr><tr>
<td>
<tr>
<td>
<img id="dlView_ctl06_imgPlan" src="../SiteImages/vidhya/40/1/ThumbNails/" style="border-width:0px;" />
</td>
</tr>
<tr>
<td>
<a onclick="javascript:showLayerUpLoad();return false;" id="dlView_ctl06_lnkChangeLogo" href="javascript:__doPostBack('dlView$ctl06$lnkChangeLogo','')">ChangeLogo</a>
<br />
<a onclick="javascript:ConfirmChoice();return false;" id="dlView_ctl06_lnkRemoveLogo" href="javascript:__doPostBack('dlView$ctl06$lnkRemoveLogo','')">RemoveLogo</a>
<input name="dlView$ctl06$txtImage" type="text" id="dlView_ctl06_txtImage" />
<input type="hidden" name="dlView$ctl06$hdnImage" id="dlView_ctl06_hdnImage" />
</td>
</tr>
</td>
</tr><tr>
<td>
<tr>
<td>
<img id="dlView_ctl07_imgPlan" src="../SiteImages/vidhya/40/1/ThumbNails/" style="border-width:0px;" />
</td>
</tr>
<tr>
<td>
<a onclick="javascript:showLayerUpLoad();return false;" id="dlView_ctl07_lnkChangeLogo" href="javascript:__doPostBack('dlView$ctl07$lnkChangeLogo','')">ChangeLogo</a>
<br />
<a onclick="javascript:ConfirmChoice();return false;" id="dlView_ctl07_lnkRemoveLogo" href="javascript:__doPostBack('dlView$ctl07$lnkRemoveLogo','')">RemoveLogo</a>
<input name="dlView$ctl07$txtImage" type="text" id="dlView_ctl07_txtImage" />
<input type="hidden" name="dlView$ctl07$hdnImage" id="dlView_ctl07_hdnImage" />
</td>
</tr>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><strong style="color:#ADADAD">URL : </strong><a id="lnkUrl" target="_blank">
<span id="lblUrl"></span>
</a></td>
</tr>
</table>
<div>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWIwKerOHHCALt3oXMAwKQ9M/rBQLf8c7OBALF9uAaAtzO1PIKAt/2m70CAvrasL4HAuDf6ooCAtzOwPcIAt/2h0IC5v+70Q0CzITOxQ8C3M6spAcC3/bDxwYCgemdpAkC5+3XyA0C3M6YqQUC3/avzAQClcS6vQkC+8jMiQUC3M6EhgMC3/bL0AoCsK2c6A4ClrLWtAkC3M7wigEC3/b3hwQCnNKn+wQCgte57wYC3M7ctw8C3/bz2g4C3/GapA8CxfbUyAMC3M6I7wgC3/bf3ww=" />
</div></form>
</body>
</html>
For the OnClientClick property on button server controls (ImageButton, LinkButton, Button) you do not use the javascript: prefix. So try to remove all your javascript: stuff and see if it works.
Ignored what I said above... LinkButton is a special case. :P
I now have a closer look at your code and the HTML output. From what I can see, there are some issues in your code:
You are dynamically changing the OnClientClick property of the btnUpload server control which sits outside the DataList. Which means the OnClientClick for the btnUpload button will change each time an item is bound to the list and the result is, if it works, the last ImageName in your datasource is passed to the btnUpload's onclick attribute in the output HTML.
The Eval("ImageName") seems only work when calling it from the GetImage() function for imgPlan. I am not too sure why this is happening. And because of this, the Text and Value of txtImage and hdnImage are not populated and this is why you did not get the value in the js.
Please review your code and let us know any results. :)
btnUpload it outside the item template for your datalast, so OnClientClick is rewritten for every item during the ItemDataBound handler. apparently for the last item in your datasource, ImageName is empty/null. move btnUpload into the item template and see if that improves the situation.

FCKEditor doesn't set Value property on postback!

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

Resources