asp.net menu xml -xpath not found - asp.net

I have asp.net menu that uses xml datasource here's the html code:
<DataBindings>
<asp:MenuItemBinding DataMember="Menu" NavigateUrlField="Nav" TextField="Text" ToolTipField="Text" />
</DataBindings>
</asp:Menu>
<asp:XmlDataSource XPath="/Menus/Menu" ID="XmlDataSource1" runat="server" DataFile="~/data.xml" >
</asp:XmlDataSource>
The xml is at:
http://www.nlprogramming.net/data.xml
The error is that the Nav property not found for navigateurlfield
Can u help me?
Thanks

Related

telerik radmenu can't add radmenuitem

I'm working on a legacy webforms app. I've added a new radmenuitem to an existing radmenu (see link2 below) but I can't see it when I compile and run the page. The existing link, Link1, appears just fine. I can even change Link1 and see the changes when testing. Link2 doesn't show. I've tried forcing the page to update by making small changes to the code behind but that doesn't work.
<telerik:RadMenu ID="Menu1" runat="server">
<telerik:RadMenuItem Text="Links" Value="Links">
<Items>
<telerik:RadMenuItem Text="Link1" runat="server" Value="Link1" NavigateUrl="http://example.com">
</telerik:RadMenuItem>
<telerik:RadMenuItem Text="Link2" runat="server" Value="Link2" NavigateUrl="http://example.com">
</telerik:RadMenuItem>
</Items>
</telerik:RadMenuItem>
</telerik:RadMenu>
I'm using Visual Studio 2017. Asp.net webforms.
You need to add <Items> tag after RadMenu. Look into your final code.
<telerik:RadMenu ID="Menu1" runat="server">
<Items>
<telerik:RadMenuItem Text="Links" Value="Links">
<Items>
<telerik:RadMenuItem Text="Link1" runat="server" Value="Link1" NavigateUrl="http://example.com">
</telerik:RadMenuItem>
<telerik:RadMenuItem Text="Link2" runat="server" Value="Link2" NavigateUrl="http://example.com">
</telerik:RadMenuItem>
</Items>
</telerik:RadMenuItem>
</Items>
</telerik:RadMenu>
It turned out to be in the code. A custom security feature was hiding certain menu items using the VB.Net code below:
For Each mItem As RadMenuItem In Menu1.Items
If mItem.Value.ToUpper() <> "HELP" Then
mItem.Visible = False
End If
Next

RSS Import Into .net

I'd like to import an RSS feed from WordPress into a .net site, limiting the import to the most current post, not the whole feed. As of now, I have to hide all posts, except the first, via the :first-child pseudo element in my non-public project's stylesheet, which won't work well in the public site (hidden content).
The following is what I have now:
<asp:DataList ID="DataList1" runat="server" DataSourceID="XmlDataSource1" CssClass="blog-rss">
<ItemTemplate>
<h4><%# XPath("title") %></h4>
<span class="author"><%# XPath("pubDate") %></span><br />
<%# XPath("description") %>
<hr />
</ItemTemplate>
</asp:DataList>
<asp:XmlDataSource ID="XmlDataSource1" Runat="server"
DataFile="http://blog.domain.com/category/signs/feed/"
XPath="rss/channel/item">
</asp:XmlDataSource>
Any suggestions or modifications to the above?
Try modifying the XPath to only get the first item in the feed
<asp:XmlDataSource ID="XmlDataSource1" Runat="server"
DataFile="http://blog.domain.com/category/signs/feed/"
XPath="rss/channel/item[1]">
</asp:XmlDataSource>

Ext.Net approach to desktop implementation

i wanto to start use a Ext.Net desktop (i use it as "normal page" for other application).
i want to know the best approach of initialization desktop from database data.
my actual approach is:
1. start with "minimal" desktop page (start menu ecc...) without any modules;
2. read data from database (based on same parameters) and create dynamic modules (i think with DesktopModuleProxy) whit userc control (ex i save path/title/etc... of usercontrol in database);
3. create usercontrol and render it in desktop
i start with this example: http://examples.ext.net/#/Desktop/Introduction/Overview/
method AddNewModule() works only if there is a submit (ex with a launcher), but it doesn't works from Page_Load event and i have this javascript error:
"Cannot read property 'length' of undefined" in ext.axd:93
maybe i use wrong lifecycle page?
finally maybe i use a webform instead usercontrol, but i have same case where i must use usercontrol...
thanks!
.aspx FILE
<ext:Desktop ID="Desktop1" runat="server">
<StartMenu Title="Ext.Net Desktop" Icon="Application" Height="300">
<ToolConfig>
<ext:Toolbar ID="Toolbar1" runat="server" Width="100">
<Items>
<ext:Button ID="Button1" runat="server" Text="Settings" Icon="Cog" />
<ext:Button ID="Button2" runat="server" Text="Logout" Icon="Key">
<DirectEvents>
<Click OnEvent="Logout_Click">
<EventMask ShowMask="true" Msg="Ciao..." MinDelay="1000" />
</Click>
</DirectEvents>
</ext:Button>
</Items>
</ext:Toolbar>
</ToolConfig>
</StartMenu>
<TaskBar TrayWidth="100">
<QuickStart>
<ext:Toolbar ID="Toolbar2" runat="server">
<Items>
<ext:Button ID="Button3" runat="server" Handler="tile" Icon="ApplicationTileVertical">
<QTipCfg Text="Tile windows" />
</ext:Button>
<ext:Button ID="Button4" runat="server" Handler="cascade" Icon="ApplicationCascade">
<QTipCfg Text="Cascade windows" />
</ext:Button>
</Items>
</ext:Toolbar>
</QuickStart>
<Tray>
<ext:Toolbar ID="Toolbar3" runat="server">
<Items>
<ext:ToolbarFill ID="ToolbarFill1" runat="server" />
</Items>
</ext:Toolbar>
</Tray>
</TaskBar>
<DirectEvents>
<Ready OnEvent="loadTest"></Ready>
</DirectEvents>
</ext:Desktop>
.cs file
[DirectMethod]
public void loadTest(object sender, DirectEventArgs e)
{
DesktopModuleProxy control = Ext.Net.Utilities.ControlUtils.FindControl<Ext.Net.DesktopModuleProxy> (this.LoadControl("/user/default.ascx"));
control.RegisterModule();
}
Error by chrome:
Uncaught TypeError: Cannot read property 'app' of undefined Default.aspx:31
Uncaught TypeError: Cannot read property 'length' of undefined ext.axd:93
these is a "last version" of my various tests. if i invoke same method "loadTest" by button (like the original example) it works. User control has only 1 label with datetime.
thanks!
You can use Ext.onReady and ext:ResourcePlaceHolder with DirectMethod on server, like this:
<ext:ResourcePlaceHolder runat="server" Mode="Script" />
<script type="text/javascript">
Ext.onReady(function () {
App.direct.YourDirectMethod();
});
</script>

How to make active link item bold when using asp.net Menu control

How to make active(selected) link item bold when using asp.net Menu control ?
You can just use the styles of the Menu control:
<asp:Menu ID="Menu1" DataSourceID="mySiteMap" runat="server"
Orientation="Horizontal" RenderingMode="Table"
StaticSubMenuIndent="16px">
<StaticSelectedStyle Font-Bold="True" />
</asp:Menu>
This is the result:
1 - View the HTML Source.
2 - Find the class name or id being used to signal an active element.
3 - Style the element appropriately using the selector found in step 2.
If the link you are after to turn bold is a level
<asp:menu id="NavigationMenu" ..............>
<levelmenuitemstyles>
<asp:menuitemstyle BackColor="LightSteelBlue" forecolor="Black"/>
</levelmenuitemstyles>
<levelselectedstyles>
<asp:menuitemstyle BackColor="Cyan" forecolor="Gray"/>
</levelselectedstyles>
</levelmenuitemstyles>
</asp:menu>

force user select from autocomplete

i am beginner for asp.net . I now facing a problem . How can i force a user to select option from ajax control toolkit autocomplete?
Here is my sample code
<cus:cusTextBox ID="txtCMemberID" runat="server" Action="Edit"
CssClass="inputTextM" OnTextChanged="txtCMemberID_TextChanged"
AutoPostBack="True"></cus:cusTextBox>
<asp:AutoCompleteExtender ID="AutoCompleteExtender2" runat="server"
ServicePath="~/Module/Common/autoComplete/acLewreMember.asmx"
MinimumPrefixLength="1" ServiceMethod="GetSuggestedStrings"
TargetControlID="txtCMemberID" CompletionInterval="10"
CompletionSetCount="3" EnableCaching="true"
CompletionListCssClass="completionListElement"
CompletionListItemCssClass="listItem"
CompletionListHighlightedItemCssClass="highlightedListItem"
FirstRowSelected="True"
ShowOnlyCurrentWordInCompletionListItem="True">
</asp:AutoCompleteExtender>
As you see the textbox is a custom control. Is that any way to force user to select option from autocomplete?Please provide me a sample code also. thanks
ASP.NET includes a useful feature called a validator.
<asp:TextBox ID="TextBox2" ValidationGroup="Group2" runat="server" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" ErrorMessage="*Required" ValidationGroup="Group2"
ControlToValidate="TextBox2" runat="server" />
<asp:Button ID="Button2" Text="Validate Group2"
ValidationGroup="Group2" runat="server" />
Here is the resource link for msdn: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.requiredfieldvalidator.aspx
I'm not sure how these work with custom controls as I'm relatively new at asp. They also have a custom validator which might be more suited for your purposes, but like I said. I don't know exactly.
Note: If the client is using an old browser this won't work, so you also want to check on the server that this field isn't empty by using:
if (Page.IsValid)
{
//stuff to do in your event handler
}

Resources