I have a basic CMS which I'm adding to a site to display some downloads organised into groups. I have two tables, one for the groups and one for the downloads. I'm using a repeated to display the groups with another repeater inside to display the children. This works perfectly.
However some of my download groups may not have any downloads related to them and I'd like to handle this by filter the groups so that only those with a relate download record(s) are shown.
I'm trying to do this with the query which populates the top repeater based on some ideas I read but I must be going wrong with the syntax.
Here is what I'm using to try and only select downloads groups which have downloads linked to them by the download group ID.
[Code]....
Can anyone offer any thoughts on how I should construct the query to perform this?
I have three level hierarchical data. using the statement below i managed to display two level data. I need to extend it to one more level.
Current hierachy is Modules-->Documents
I need to extend it as Packages-->Modules-->Documents
var data = (from m in DataContext.SysModules join d in DataContext.SysDocuments on m.ModuleID equals d.ModuleID into tempDocs from SysDocument in tempDocs.DefaultIfEmpty() group SysDocument by m).ToList();
I have to handle error related to web application. I am not sure how its works. I am thinking that I will add an error page (error.aspx) and in global.asax ,application_onError, I will redirecting the user to error page and that should be enough ! i mean it will handle error automatically.
I want to be able specify to do the following: Specify configuration settings such as appSettings and connectionStrings for multiple web apps in IIS7 No editing Machine.config or the machine-level web.config Web apps are distinct web sites in IIS (not subfolder apps) Is this possible without just duplicating the configs for each app?
I have very strange Cascading Dropdownlist behavior. When I use one parent, one child - everything is fine, but one parent two children combination does not work well. Sometimes both children show right data; sometime first is fine and second is grey, or first is fine and second [Method error 500], or second is fine and first is wrong and so on.
Did somebody try to use parent two children combination?
I have two tables in SQL. The first defines the parent, and has a primary key column called ParentId. I also have a child table that has a primary key, and a foreign key as 'ParentId'. So the two tables form a one parent - to many children relationship.
The question is what is the most efficient way to pull the parent + child data C# code? The data has to be read into the following objects:
[Code]....
and use LINQ to merge all parents with children. This approach makes 2 trips to the db.
The third and final (also most inefficient) approach is to grab all parents, and while constructing each parent object, make a trip to the DB to grab all its children. This approach takes n+1 connections: 1 for all parents and n number of trips to get all children for each parent.
Any advise on how to do this easier? Granted i can't get away from using stored procedures, and I can't use LINQ2SQL or EF. Would you prefer Data Tables vs DataReaders and if so how to use either with approach 1 or 2?
I'm working on a Navigation Menu. I've created below ServerControl and it works, but I want to allow users adding some standard ASP.NET controls within my ServerControl Tags like label, image and so on.
<MdsMenu:ServerControlMenu ID="ServerControlMenu1" runat="server"> <MdsMenu:animation AnimationSpeed="Normal" AnimationType="Opacity_Height" Delay="1000" DropShadow="true" /> <!-- HERE HAS TO HAVE SOME STANDARD ASP.NET CONTROLS --> <!-- e.g <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> --> </MdsMenu:MenuItem> </MdsMenu:ServerControlMenu>
My problem is here that how I can get Child Controls within <MdsMenu:MenuItem> and show them like as they are in the output. P.S: I overwrite RenderContents method
I'm trying to bind the contents of a node of XML to a Drop Down List without much success. Initially, the whole XML document is bound to a repeater - this works perfectly, but now I need to display a drop down list based on the children in the "" node, but I get Data at the root level is invalid. Line 1, position 1 error message on the DataBind() method on the dropDownList. The code snippet I'm using is:
how to implement page level and control level security in MVC applications. Also I would like to know the definition for Page Level and Control Level Security in MVC. Please refer me if any third party tools avilable to implement security in MVC.
I have a parent/child relationship that I'm currently pulling via the EF .include() method and displaying via two foreach loops in my view -- the first foreach loop is for the parents and the second is nested inside each parent and is for the children of that parent.
This has worked fine, but now I need to display information about each child that is not contained in my main child table. The table that contains this extra information only has a relationship to the main child table and thus there is no association between this table and the main parent table --- i.e. the .include() method can't pick this up. I've looked, found nothing and thus assume that I can't have two .include methods chained together. (even if I could, would this be efficient?)
I know I can perform a simple join and pull all of the child information with the parent records, but that would create issues with my paging because I want the page size determined by the number of parent records displayed. For some parents, there are only two children; other parents may have 10 children. So a simple join would create records where the parent information is duplicated and would throw off the paging.
Ideally I'd like to pull the parent information and pull the children information and connect the two when the view is populated, but I don't have a clue on how to do this efficiently (if that's even possible).
I want a create a custom/user control that has children.
For Example, I want my control to have the following markup:
<div runat="server" id="div"> <label runat="server" id="label"></label> <div class="field"> <!-- INSERT CHILDREN HERE --> </div> </div>
and when I want to use it on a page I simply:
<ctr:MyUserControl runat="server" ID="myControl"> <span>This is a child</span> <div runat="server" id="myChild">And another <b>child</b> </ctr:MyUserControl>
The child controls inside my user control will be inserted into my user control somewhere. What is the best way to accomplish this?
The functionality is similar to a asp:PlaceHolder but I want to add a couple more options as well as additional markup and the such. Also the child controls still need to be able to be accessed by the page. (in the example above the page should have the myChild Control on it)
EDIT ------
It can be a template control as long as it allows me to reference the children on the page.
I want to remove parent control (which is span in this case) without deleting its children controls from container. how can I accomplish this in asp.net c#?
you can see the code here: http://pastebin.com/9NiriWXN
Note: I can easily find the "newsright" control and return its parent (which is span in this case)
I'm working on a Navigation Menu. I've created below ServerControl and it works, but I want to allow users adding some standard ASP.NET controls within my ServerControl Tags like label, image and so on.
<MdsMenu:ServerControlMenu ID="ServerControlMenu1" runat="server"> <MdsMenu:animation AnimationSpeed="Normal" AnimationType="Opacity_Height" Delay="1000" DropShadow="true" /> <!-- HERE HAS TO HAVE SOME STANDARD ASP.NET CONTROLS --> <!-- e.g <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> --> </MdsMenu:MenuItem> </MdsMenu:ServerControlMenu>
My problem is here that how I can get Child Controls within <MdsMenu:MenuItem> and show them like as they are in the output.
I want my control to accept some controls as childs without typing the template name, just like the Panel, as shown here:
<asp:Panel runat="server"> My content <div>Content</div> </asp:Panel>
I have controls with content inside without telling what is the ITemplate.
I basically want to convert this
<my:MyControl runat="server"> <ContentTemplate> My content <div>Content</div>
[Code]....
The above works with <Content></Content> tags inside the control, but without it doesn't work. And the attribute isn't doing anything at all (I guess). What's missing?
Here's mt entity: Csharp Code: using System;using System.Collections.Generic;using System.Linq;namespace Venue.Domain{ using Venue.Infrastructure.Domain; public class Forum : Entity { private IList<Forum> children = new List<Forum>(); private IList<Moderator> moderators = new
[code]....
Here's my class map:
Csharp Code: using FluentNHibernate.Mapping;namespace Venue.Persistence.Mapping{ using Venue.Domain; public class ForumMap : ClassMap<Forum> { public ForumMap() { Id(x => x.Id); Map(x => x.Sequence); Map(x => x.Title);
[code]....
And here's my convention:
Csharp Code: using FluentNHibernate.Conventions;using FluentNHibernate.Conventions.Instances;namespace Venue.Persistence.Mapping.Conventions{ public class ReferenceConvention : IReferenceConvention { public void Apply(IManyToOneInstance instance) { instance.Column(instance.Property.Name + "Id"); } }}
I get the following message:Could not find a setter for property Children ...
I have a very simplistic user control that looks like this:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="wfWindow.ascx.cs" Inherits="webfanatix.co.za.wfWindow" %> <div>Just a test...[x]</div>
with this code behind:
[ParseChildren(false)] [PersistChildren(true)] public partial class wfWindow : System.Web.UI.UserControl { protected override void Render(HtmlTextWriter writer) { RenderChildren(writer); } }
And the usage thereof looks like this:
<wf:wfWindow runat="server">This content should go where [x] is.</wf:wfWindow>
I'm no ASP.NET pro, so how do I get the content to render exactly where the [x] appears in my user control?
RenderChildren is rendering my content, but it is only appended to the end of the UserControl output. I need it to go and sit right where [x] marks the spot.
Now, How can I Parse it and render it in RenderContent method ? !!! The following method is always throw the first Exception, it means this.Controls is always empty !!! How can I do it and how I can access to the nested children in RenderControl method ?
public class Menu : WebControl { .... public override void RenderControl(HtmlTextWriter output) { if (!this.HasControls()) throw new Exception("Controls are empty"); .... } }
I am not seeing the children controls on my web page when I hover over their parents. For example, I see the File, Edit and View menu items but I do not see the File->Open menu.
I have been having an issue when expanding a treeview, it looks fine when I load it, but when I click on a parent node it does expand, but also puts like 2 other parent nodes undernearth it. I am thinking it's because the treeview is saying that the parent nodes that have children have an index of 0, while everything else as there own index.
Basically I have RegisterModel2 that has a Person class. My requirement is that Phone Number and Address are not required for registration. But if they try to enter a Phone number of Address then it should validate it. Problem is that it is always stating that the child fields of Phone (area code, number) and child fields of Address (street1,city,etc) are required. Is there a way to annotate in the RegisterModel that a parent class is not Required but if any data in a child element is given then and only then should the child elements be validated?
My Person EDM class has a nullable 0.1 -> 0.1 navigation property to Phone and Address.Here is the person class
[MetadataType(typeof(Person_Validation))] public partial class Person { }
public class Person_Validation [code]....
The Person EntityObject has an optional/nullable Navigation Property to the Phone Object.
The Phone object has these annotations,[Code]....
I have RegisterModel defined as follows: [Code]....
My View looks like this: [Code]....
And here is my Controller Action it is posting to: [Code]....
I've been wracking my brains for a while. I have a master record that I want to add children to. In a database it's a one to many relationship with a foreign key in the child table.
I have a formview that I want to use to fill in all the master record info, and choose the child info from a dropdownlist, and click an add button, and have the add button add the child info to some control on a page. Then when the user clicks insert, the formview has an ItemInserting EventHandler that will handle all the logic for inserting the master, grabbing its primary Key.
So, I know what to do, I'm just not sure of what control to use, or what memory object etc., that I want to store the child info in until the master record gets created.
I'm sure this has been done a million times, but for all my searching, I couldn't find anything to help me. Does anybody have some advice or can anybody point me to an internet resource where this has been hashed out?
I have created a really simple custom control to render panels into a page. The code is below. When I use my control and add any webcontrol to it, after each page postback the contents of these child controls vanishes.
I must have missed something really simple but run the example to reproduce this. Can anyone please enlighten me as to why the controls are being 'emptied' of their contents, and how I stop this occuring?