My <title>VARIABLE</title> include text "| website" in all my titles , I want to remove this text from my title using replace function. I have no experience of C# but need to do this work. I have checked its RAZOR framework. Please add the code between the title tag using my variable you can see in the title tag of code.
#using System.Web.Optimization
#using Sana.RazorDeface
#{
var customerServiceUrl = Url.Sana.Resolve(Shop.Settings.CustomerServicePage);
}
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js ie8"><![endif]-->
<!--[if IE 9]><html class="no-js ie9"><![endif]-->
<!--[if IE 10]><html class="no-js ie10"><![endif]-->
<html class="no-js" lang="#Sana.PageLanguage">
<!--<![endif]-->
<head>
<title>#PageInfo.Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="#Html.FormatMetaDescription(PageInfo.MetaDescription)" />
<meta name="robots" content="#PageInfo.Robots" />
<meta name="generator" content="Sana Commerce" />
#When(PageInfo.Robots.Index, render => Html.CanonicalLink())
#When(PageInfo.Robots.Index, render => Html.AlternateLinks())
#Html.Partial("_PageTracking")
#Styles.Render("~/content/css/store")
<link href="#Url.ThemeStyleSheet(PageInfo.UseDefaultTheme.GetValueOrDefault(true))" type="text/css" rel="stylesheet" />
#Html.Partial("_ExternalFonts")
#When(Sana.IsPrintMode, then => Styles.Render("~/content/css/extra/print"))
#When(Sana.IsEditorMode, then => Styles.Render("~/content/css/extra/editor"))
#When(Sana.IsProfilerEnabled, then => Styles.Render("~/content/css/extra/profiler"))
#RenderSection("Head", required: false)
#Html.EnterpriseDebugString()
#Sana.HtmlInjection("Head")
<meta name="google-site-verification" content="nbS3GoTrL6EPv9TF7RbIDwT9hpvbEb6ecPZfSsxWSzs" />
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-135059944-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-135059944-1');
</script>
</head>
<body class="#GetPageCssClasses()" data-url-root="#Href("~/")" data-url-home="#When(Shop.CommerceContext.NoSqlConnection, Href("~/"), Url.Sana.HomePage())" data-currency="#Shop.CommerceContext.CurrencyId">
#Html.Partial("_PageTrackingNoscript")
#Sana.HtmlInjection("BodyStart")
<div class="site">
<noscript>
<div class="msg-block no-script">
#Sana.RichText("NoScriptMessage")
</div>
</noscript>
#(Sana.IsProfilerEnabled ? Html.Partial("_Profiler") : null)
#When(Sana.IsEditorMode, render => Html.Partial("_FrontendEditorToolbar"))
<header class="nav-is-closed">
<div class="header-blocks-wrapper">
<div class="top-header">
#Html.Partial("_HeaderInfoMessage")
<div class="top-action">
#RenderSection("Language", required: false)
#if (!customerServiceUrl.IsEmptyString())
{
#Sana.SimpleText("CustomerService")
}
#RenderSection("Login", required: false)
</div>
</div>
<div class="middle-header">
#RenderSection("Logo", required: false)
#RenderSection("Search", required: false)
#RenderSection("Basket", required: false)
</div>
<div class="bottom-header">
<div class="center">
<div class="nav-opener-wrapper">
<div class="nav-opener"></div>
</div>
#RenderSection("TopMenu", required: false)
</div>
</div>
</div>
</header>
<div class="school-selection-header">
#RenderSection("TopSchoolSelection", required: false)
</div>
<div class="content">
#RenderBody()
</div>
<footer>
<div class="center">
<div class="columns-general top">
#RenderSection("Sitemap", required: false)
#RenderSection("Newsletter", required: false)
</div>
<div class="columns-general bottom">
#RenderSection("Footer", required: false)
</div>
</div>
</footer>
#Html.Partial("LoadingIndicator")
</div>
#Html.AntiForgeryToken()
#Scripts.RenderFormat("<script defer src=\"{0}\"></script>", "~/content/script/libs")
#Scripts.RenderFormat("<script defer src=\"{0}\"></script>", "~/content/script/shop")
#if (Sana.IsProfilerEnabled)
{
#Html.ProfilerIncludes()
#Scripts.RenderFormat("<script defer src=\"{0}\"></script>", "~/content/script/profiler")
}
#When(Sana.IsEditorMode, render => Html.Partial("_FrontendEditorScripts"))
#RenderSection("Scripts", false)
#DefaceScripts.Profiler(Context)
#Sana.HtmlInjection("BodyEnd")
</body>
</html>
Try this. Hope this works.
<title>#PageInfo.Title.Replace("| website"," ")</title>
Related
<html lang="en" class="gr__r6db_com">
<head>
<meta charset="UTF-8">
<title>Search results for kinglio | R6DB</title>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#ff0000">
<meta id="meta_desc" name="description" content="Search players named kinglio on R6DB">
<meta name="keywords" content="r6db,gitgudscrub,rainbow 6, rainbow six siege, database">
<meta name="apple-mobile-web-app-title" content="R6DB">
<meta name="application-name" content="R6DB">
<meta name="theme-color" content="#ffffff">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/css/app.css">
</head>
<body data-gr-c-s-loaded="true">
<div id="mount">
<div class="app is-results">
<div class="app-background">
<img src="/assets/nippon.jpg" class="clear">
<img src="/assets/nippon-blurred.jpg" class="blur">
</div>
<div class="app-page">
<div class="search">
<h1 class="title is-1 search-title">R6DB</h1>
<div class="search-form">
<div class="column is-small-8 search-input">
<input type="text"><span><input type="checkbox" id="exactSearch"><label for="exactSearch">exact name</label></span>
</div>
<button class="search-submit">Search</button>
</div>
<div class="colums is-multiline search-results">
<div class="playercard player-6881796a-9f51-4386-83f9-136ea45d0faa is-user is-visible">
<a href="/player/6881796a-9f51-4386-83f9-136ea45d0faa" class="card-image">
<img src="/assets/noavatar.png">
</a>
<div class="card-content">
<div class="player-identification">Kinglio<span class="player-id">6881796a-9f51-4386-83f9-136ea45d0faa</span>
</div>
<div class="player-aliases">
<header>known aliases</header>
<ul>
<li>Kinglio</li>
</ul>
</div>› view on uplay
</div>
</div>
<div class="playercard player-344b8c89-7deb-4e0f-ad42-942ee314c072 is-user is-visible">
<a href="/player/344b8c89-7deb-4e0f-ad42-942ee314c072" class="card-image">
<img src="//uplay-avatars.s3.amazonaws.com/344b8c89-7deb-4e0f-ad42-942ee314c072/default_146_146.png">
</a>
<div class="card-content">
<div class="player-identification">KingLio.-<span class="player-id">344b8c89-7deb-4e0f-ad42-942ee314c072</span>
</div>
<div class="player-aliases">
<header>known aliases</header>
<ul>
<li>KingLio.-</li>
<li>KingLio.TG</li>
<li>and 7more</li>
</ul>
</div>› view on uplay
</div>
</div>
<div class="playercard player-922eec9c-61b6-4a09-892e-96ae2be3218d is-user is-visible">
<a href="/player/922eec9c-61b6-4a09-892e-96ae2be3218d" class="card-image">
<img src="//uplay-avatars.s3.amazonaws.com/922eec9c-61b6-4a09-892e-96ae2be3218d/default_146_146.png">
</a>
<div class="card-content">
<div class="player-identification">PS4Gamer.--<span class="player-id">922eec9c-61b6-4a09-892e-96ae2be3218d</span>
</div>
<div class="player-aliases">
<header>known aliases</header>
<ul>
<li>PS4Gamer.--</li>
<li>KingLio.1L</li>
<li>and 2more</li>
</ul>
</div>› view on uplay
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script async="" src="https://www.google-analytics.com/analytics.js"></script>
<script src="/js/app.js"></script>
<iframe src="chrome-extension://hgimnogjllphhhkhlmebbmlgjoejdpjl/bar.html" id="xh-bar" class="hidden"></iframe>
<img id="hzDownscaled" style="position: absolute; top: -10000px;">
</body>
</html>
I am trying to scrape a unique ID from a website depending on what a user enters into a text box. However, I am failing to use a correct Xpath, no matter what I try.
Here is my most recent attempt
string searchUsernameUrl = "https://www.r6db.com/search/" + txtUsername.Text;
HtmlWeb searchWeb = new HtmlWeb();
HtmlAgilityPack.HtmlDocument searchDoc = searchWeb.Load(searchUsernameUrl);
try
{
txtUplayID.Text = searchDoc.DocumentNode.SelectNodes("//div[#class='colums is-multiline search-results']/div[1]/div/div[1]/span")[0].InnerText;
}
catch (NullReferenceException)
{
MessageBox.Show("Unable to find username ID.", "Error");
}
Here is the html code to the website. Upon searching, any number of results may appear. In this example there are 3. I only want to copy the code from the first example.
Here is a picture of the HTML from the website upon searching, showing what I need an xpath for
LAYOUT
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<!-- Apple devices fullscreen -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<!-- Apple devices fullscreen -->
<meta names="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<title>New Indus Goods - Loagin</title>
<link rel="stylesheet" type="text/css" href="#Url.Content("~/css/bootstrap.min.css")"/>
<link rel="stylesheet" type="text/css" href="#Url.Content("~/css/plugins/icheck/all.css")"/>
<link rel="stylesheet" type="text/css" href="#Url.Content("~/css/style.css")"/>
<link rel="stylesheet" type="text/css" href="#Url.Content("~/css/themes.css")"/>
<link href="#Url.Content("~/Styles/view_specific_style.css")" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="#Url.Content("~/js/jquery.min.js")"></script>
<script type="text/javascript" src="#Url.Content("~/js/plugins/nicescroll/jquery.nicescroll.min.js")"></script>
<script type="text/javascript" src="#Url.Content("~/js/plugins/validation/jquery.validate.min.js")"></script>
<script type="text/javascript" src="#Url.Content("~/js/plugins/validation/additional-methods.min.js")"></script>
<script type="text/javascript" src="#Url.Content("~/js/plugins/icheck/jquery.icheck.min.js")"></script>
<script type="text/javascript" src="#Url.Content("~/js/bootstrap.min.js")"></script>
<script type="text/javascript" src="#Url.Content("~/js/eakroko.js")"></script>
<!--[if lte IE 9]>
<script type="text/javascript" src="#Url.Content("~/js/plugins/placeholder/jquery.placeholder.min.js")"></script>
<script>
$(document).ready(function() {
$('input, textarea').placeholder();
});
</script>
<![endif]-->
<!-- Favicon -->
<link rel="shortcut icon" href="~/img/favicon.ico" />
<!-- Apple devices Homescreen icon -->
<link rel="apple-touch-icon-precomposed" href="~/img/apple-touch-icon-precomposed.png" />
</head>
<body class='login'>
<div class="wrapper">
<h1>
<a href="index.html">
<img src="#Url.Content("~/img/logo-big.png")" alt="" class='retina-ready' width="59" height="49">New Indus Goods</a>
</h1>
<div id="body" class="login-body">
#RenderSection("featured",required:false)
<section class="content-wrapper">
#RenderBody()
</section>
</div>
</div>
</body>
</html>
VIEW
#model Test1.Models.UserProfile
#{
Layout = "~/Views/_LayoutPage1.cshtml";
ViewBag.Title = "Index";
Test1.Models.UserProfile lol = ViewBag.Profile;
}
#section featured
{
#using (Html.BeginForm("Index", "Input"))
{
#Html.ValidationSummary(true)
<fieldset>
<div class="content-wrapper">
<div class="form-group">
<div class="email controls">
#Html.EditorFor(model => model.Name, new { #class = "form-control" })
#Html.ValidationMessageFor(model => model.Name)
</div>
</div>
</div>
<p>lol what is is</p>
</fieldset>
<p>
<input type="submit" value="Save" />
</p>
}
}
<div>
#Html.ActionLink("Back To Index", "Index");
</div>
Server side validation is performed but client side is not happening! please tell me what am I missing here?? I have tried finding a solution on Google but failed. I am new to MVC so kindly help me! Page goes back for POST then come back and says Name field is required, why it is not validating before POSTING BACK??
i had to add
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
in page-related web.config too :)
I am using this post to disable my buttons on click:
Prevent multiple form submits in MVC 3 with validation
This is my page source after it is rendered:
<!DOCTYPE html>
<html>
<head>
<title>Do not bookmark this page.</title>
<link href="/Content/reset.css" rel="stylesheet" type="text/css" />
<link href="/Content/Site.css" rel="stylesheet" type="text/css" />
<link href="/Content/styer.css?t=335" rel="stylesheet" type="text/css" />
<script src="/Scripts/jquery-1.5.1.min.js" type="text/javascript"></script>
<script src="/Scripts/Views/main.js" type="text/javascript"></script>
<link rel="shortcut icon" href="/Content/favicon.ico" type="image/ico" />
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<script language="javascript" type="text/javascript">
$(function () {
$('form').submit(function () {
if ($(this).valid()) {
$('input[type="submit"]').attr('disabled', 'disabled');
}
});
});
</script>
</head>
<body>
<div class="page">
<div id="header">
<div id="headerimg"></div>
<div id="logindisplay">
[ Log On ]
</div>
<div id="menucontainer">
<ul id="menu">
<li>Home</li>
<li>Logon</li>
<li>Register</li>
<li>Contact Us</li>
<li>News</li>
</ul>
</div>
<div id="main">
<h2>Forgot Username</h2>
<p>
Please provide the email address on your web account. Once validated, your username will be sent to your email address for your records.
</p>
<script src="/Scripts/jquery.validate.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>
<form action="/Account/ForgotUsername" method="post"> <div>
<fieldset>
<legend>Email address</legend>
<div class="editor-label">
<label for="EmailAddress">Email</label>
</div>
<div class="editor-field focus">
<input class="GenericTextBox" data-val="true" data-val-length="The Email must be at least 7 characters long." data-val-length-max="100" data-val-length-min="7" id="EmailAddress" name="EmailAddress" type="text" value="" />
<span class="field-validation-valid" data-valmsg-for="EmailAddress" data-valmsg-replace="true"></span>
</div>
<p>
<input id="btn" class="makePaymentInput" type="submit" value="Submit"/>
</p>
</fieldset>
</div>
</form>
<div style="clear: both;"></div>
</div>
<div id="footer">
</div>
</div>
</div>
<!-- Start of StatCounter Code for Default Guide -->
<script type="text/javascript">
var sc_project = 9150358;
var sc_invisible = 1;
var sc_security = "1af31df9";
var scJsHost = (("https:" == document.location.protocol) ? "https://secure." : "http://www.");
document.write("<sc" + "ript type='text/javascript' src='" + scJsHost + "statcounter.com/counter/counter.js'></" + "script>");
</script>
<noscript>
<div class="statcounter"><a title="web analytics" href="http://statcounter.com/" target="_blank"><img class="statcounter" src="http://c.statcounter.com/9150358/0/1af31df9/1/" alt="web analytics"></a></div>
</noscript>
<!-- Visual Studio Browser Link -->
<script type="application/json" id="__browserLink_initializationData">
{"appName":"Internet Explorer"}
</script>
<script type="text/javascript" src="http://localhost:25759/610299fe88d74cee8d0267b4fc859da0/browserLink" async="async"></script>
<!-- End Browser Link -->
</body>
</html>
This works on most forms but this one, which is the main reason I used this code.
Anyone see why this one is not working?
Instead of writing this :-
$('input[type="submit"]').attr('disabled', 'disabled');
You should write this :-
$('input[type="submit"]').prop('disabled','true');
I have layout page for my mvc webpage where i have done the stuff like.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>#ViewBag.Title</title>
</head>
<body>
<div class="page">
<div id="header">
<div>
#{
SessionDetail sess = new SessionDetail();
ICacheProvider cache = (ICacheProvider)DIConfig.GetInstance("cacheprovider");
sess = (SessionDetail)cache.Get(Session["usersession"].ToString());
}
<div id="menu" align="right">
<li class="first" style="list-style-type: none;">Welcome <b>**#sess.DisplayName**</b>! |#Html.ActionLink("Logout","Logout","Account")</li>
</div>
<div class="site-title">
<h2>Dheutto</h2>
</div>
</div>
<div align="right">#Html.ActionLink("Show Devices","Index","Device")</div>
</div>
</body>
</html>
Now from here i have the session details in sess object. Is it possible for me to carry the value in sess object to all the view pages that render under this layout page?
For some reason my Telerik MVC Editor() is not working. Can anyone spot what I´m doing wrong?
I´m using MVC4 with Razor view engine and Telerik version 2012.1.214
_Layout.cshtml includes this:
#using Smekklegt.Models
#using Telerik.Web.Mvc.UI
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="is" xml:lang="is">
<head>
<meta charset="utf-8" />
<title>#ViewBag.Title</title>
<link href="#Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
<link href="#Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
<script src="#Url.Content("~/Scripts/jquery-1.7.2.min.js")" type="text/javascript"></script>
<script src="#Url.Content("~/Scripts/jquery-ui-1.8.20.js")" type="text/javascript"></script>
<script src="#Url.Content("~/Scripts/modernizr-2.5.3.js")" type="text/javascript"></script>
<script src="#Url.Content("~/Scripts/AjaxLogin.js")" type="text/javascript"></script>
<meta name="viewport" content="width=device-width" />
<!-- Skrár frá template-->
<link href="#Url.Content("~/Content/rikona/styles/galleriffic.css")" rel="stylesheet" type="text/css" />
<link href="#Url.Content("~/Content/rikona/style.css")" rel="stylesheet" type="text/css" />
<script src="#Url.Content("~/Content/rikona/js/jquery-1.3.2.js")" type="text/javascript"></script>
<script src="#Url.Content("~/Content/rikona/js/jquery.opacityrollover.js")" type="text/javascript"></script>
<script src="#Url.Content("~/Content/rikona/js/jquery.galleriffic.js")" type="text/javascript"></script>
<script src="#Url.Content("~/Content/rikona/js/gallery-settings.js")" type="text/javascript"></script>
<!--[if IE 6]>
<script src="../../Content/rikona/js/ie6-transparency.js"></script>
<script>
DD_belatedPNG.fix('#header .logo img, .subtitle img, .slideshow-container, .navigation-container #thumbs .thumbs li .thumb img, .navigation a.next, .footer-line, #sidebar .author-photo, .line, .commentlist .comment-reply-link, #contact-page #contact .submit');
</script>
<link rel="stylesheet" type="text/css" href="../../Content/rikona/styles/ie6.css" />
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="../../Content/rikona/styles/ie7.css" />
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="../../Content/rikona/styles/ie8.css" />
<![endif]-->
#(Html.Telerik().StyleSheetRegistrar()
.DefaultGroup(group => group
.Add("telerik.common.css")
.Add("telerik.simple.css")
.Combined(true)
.Compress(true))
)
</head>
<body>
<div id="wrap">
<div id="header">
<section id="login" style="float: right;">
#Html.Partial("_LogOnPartial")
</section>
<section style="float: left;">
<ul>
<li>#Html.ActionLink("Flokkar", "Index", "Category")</li>
<li>#Html.ActionLink("Vörur", "Index", "Product")</li>
</ul>
</section>
<div class="logo">
<img src="../../Content/rikona/images/smekklegt_banner2.jpg" alt="logo" width="400px;" />
</div>
<div id="nav">
<ul id="nav-pages">
<li>#Html.ActionLink("Forsíða", "Index", "Home")<span>|</span></li>
#foreach (Category category in (IEnumerable<Category>)ViewData["Categories"])
{
<li>#Html.ActionLink(category.Name, "FindProductsByCategory", "Product", new { catId = category.Id }, null)<span>|</span></li>
}
<li>#Html.ActionLink("smekklegt.is", "Contact", "Home")</li>
</ul>
</div>
</div>
<div id="frontpage-content">
<div id="container">
#RenderSection("featured", false)
<section class="content-wrapper main-content clear-fix">
#RenderBody()
</section>
</div>
</div>
<div id="footer" style="margin-top: 15px;">
<div class="footer-line">
</div>
<p>
© #DateTime.Now.Year Smekklegt ehf</p>
<div class="float-right">
<ul id="social">
<li>Facebook</li>
</ul>
</div>
</div>
#Html.Telerik().ScriptRegistrar().jQuery(false).DefaultGroup(g => g.Combined(true).Compress(true))
</div>
Create.cshtml includes this:
#using Telerik.Web.Mvc.UI
#model Smekklegt.Controllers.ProductFormViewModel
#{
ViewBag.Title = "Create";
}
<h2>Create</h2>
<script type="text/javascript" src="#Url.Content("~/Scripts/jquery.validate.min.js")"></script>
<script type="text/javascript" src="#Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")"></script>
#using (Html.BeginForm()) {
#Html.ValidationSummary(true)
<fieldset>
<legend>Product</legend>
<div class="editor-label">
#Html.LabelFor(model => model.Product.Name)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.Product.Name)
#Html.ValidationMessageFor(model => model.Product.Name)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.Product.FK_Category)
</div>
<div class="editor-field">
#*#Html.EditorFor(model => model.Product.FK_Category)*#
#Html.DropDownListFor(d => d.Categories, new SelectList(Model.Categories, "Id", "Name"))
#Html.ValidationMessageFor(model => model.Product.FK_Category)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.Product.Description)
</div>
<div>
#{ Html.Telerik().EditorFor(m => m.Product.Description)
.Name("ProductCreateEditor")
.Encode(false)
.HtmlAttributes(new { style = "width: 500px;" })
.Tools(t => t.Clear()
.Bold().Italic().Underline().Separator().JustifyCenter().JustifyLeft().JustifyRight().JustifyFull())
//.Value((string)ViewData["ProductDescription"])
.Render(); }
</div>
<p>
<input type="submit" value="Stofna" />
<input type="button" value="Til baka" onclick="javascript:history.go(-1)"/>
</p>
</fieldset>
}
The problem I have is that every time I load my page the telerik editor appears but I can not write into the text area. (It looks like it were disabled) :(
Update
Remove this line from your Layout
<script src="#Url.Content("~/Content/rikona/js/jquery-1.3.2.js")" type="text/javascript"></script>
You only need one version of Jquery, they are conflicting is my best bet.
Everything else looks right
Remove this line
.Value((string)ViewData["ProductDescription"])
You are using EditorFor which pulls the value out of the model. So you only need to set the value in one place. You were trying to set it in two places, in the EditorFor and Value.
If you were using just Editor not EditorFor you can use Value
So choose to do EditorFor like so:
#{ Html.Telerik().EditorFor(m => m.Product.Description)
.Name("ProductCreateEditor")
...
.Render();
}
Or Editor
#{ Html.Telerik().Editor()
.Name("ProductCreateEditor")
...
.Value((string)ViewData["ProductDescription"])
.Render();
}
As John also states make sure the placement of your Telerik script is in the right place. It must be in the _Layout page at the bottom like so;
#(Html.Telerik().ScriptRegistrar().jQuery(false).DefaultGroup(group => group.Combined(true).Compress(true)))
</body>
</html>