Related Tags:
Asp.Net It was developed by Microsoft to allow programmers to build dynamic web sites, web applications and web services. It was first released in January 2002 with version 1.0 of the .NET Framework, and is the successor to Microsoft's Active Server Pages (ASP) technology. Learn More, C# C# (pronounced "C-sharp") is an object-oriented programming language from Microsoft that aims to combine the computing power of C++ with the programming ease of Visual Basic. C# is based on C++ and contains features similar to those of Java. Learn More, CMS A content management system (CMS) is a software application or set of related programs that are used to create and manage digital content. CMSes are typically used for enterprise content management (ECM) and web content management (WCM) Learn More, Sitefinity Telerik Sitefinity is an ASP.NET 2.0-based Content Management System (CMS) that enables the construction of dynamic, fully editable Web sites. Sitefinity provides the tools for quick and easy construction of a wide variety of attractive and functional Web sites. Learn More,

how to create a custom widget to display details for a dynamic module item ,which will show details against UrlName?

Description:I have tried creating a custom detail widget in which I am getting item details against UrlName property and dropped that newly created widget on my detail page but when I am appending UrlName after my detail page url it redirects me to error page 404 instead of passing the UrlName to my widget's code behind. I am using sitefinity 8 (project built using asp.net web forms). is there a way that will allow me to pass UrlName after my details page url.(similar to news detail using default widget)

Posted by: | Posted on: Jun 20, 2019

1 answers

Replies

3

If I understand your problem correctly then following code will solve your problem which will allow you appending UrlName of the item after your detail page url. (You can add following line at page_load event as well.)

RouteHelper.SetUrlParametersResolved();

To get that UrlName in your detail's widget/control you can create a property in your C# code which will fetch that appended UrlName for you as shown in the following code chunk.

private string ItemUrlName
{
get
{
string urlName = string.Empty;
if (Page != null)
{
var parms = (string[])Page.Request.RequestContext.RouteData.Values["Params"];
if (parms != null && parms.Length > 0)
{
urlName = parms[0];
RouteHelper.SetUrlParametersResolved();
}
}
return urlName;
}
}

Replied by: | Replied on: Jun 20, 2019



Reply
×

Code block Hyperlink bold Quotes block Upload Images

Preview