Search Results

Search found 12 results on 1 pages for 'shivesh'.

Page 1/1 | 1 

  • Linq join with COUNT

    - by shivesh
    I have 2 tables, Forums and Posts. I want to retrieve all Forums fields with a new extra field: count all post that belong to this forum. I have this for now: var v =(from forum in Forums join post in Posts on forum.ForumID equals post.Forum.ForumID select new { forum, //Need to retrieve all fields/columns from forum PostCount = //count all post that belong to this forum with a condition: count it only if post.Showit==1 } ).Distinct() The join must be Left join: if there are no post that belongs to some forum, the forums fields should be retrieved but PostCount field should be 0. The result set must be distinct (join gives me the full cross...or how it's called)

    Read the article

  • Linq-to-Entities Left JOIN

    - by shivesh
    This is my query: from forum in Forums join post in Posts on forum equals post.Forum into postGroup from p in postGroup where p.ParentPostID==0 select new { forum.Title, forum.ForumID, LastPostTitle = p.Title, LastPostAddedDate = p.AddedDate }).OrderBy(o=>o.ForumID) Currently the Join is not left join, meaning if some forum doesn't have a post that belongs to it, it will not be returned. The forum without posts must be returned with null (or default) values for the post properties.

    Read the article

  • Help with Regular Expression

    - by shivesh
    Hello I need help with Regular Expression, I want to match each section (number and it's text - 2 groups), the text can be multi line, each section ends when another section starts (another number) or when .END is reached or EOF. Demo Expression: \(\d{1,3}\) ([\s\S]*?)(\.END|\(\d{1,3}\)) Input text: (1) some text some text some text some text some text some text (2) some text some textsome text (3) some textsome text some textsome textsome text (4) some text .END first group should match number (with brackets) and second group should match corresponded text.

    Read the article

  • Access ConfigurationSection from ConfigurationElement

    - by shivesh
    I have a configuration class that maps web.config, something like that: public class SiteConfigurationSection : ConfigurationSection { [ConfigurationProperty("defaultConnectionStringName", DefaultValue = "LocalSqlServer")] public string DefaultConnectionStringName { get { return (string)base["defaultConnectionStringName"]; } set { base["defaultConnectionStringName"] = value; } } [ConfigurationProperty("Module", IsRequired = true)] public ModuleElement Module { get { return (ModuleElement)base["Module"]; } } } public class ModuleElement : ConfigurationElement { [ConfigurationProperty("connectionStringName")] public string ConnectionStringName { get { return (string)base["connectionStringName"]; } set { base["connectionStringName"] = value; } } public string ConnectionString { get { string str; if (string.IsNullOrEmpty(this.ConnectionStringName)) { str =//GET THE DefaultConnectionStringName from SiteConfigurationSection; } else str = this.ConnectionStringName; return WebConfigurationManager.ConnectionStrings[str].ConnectionString; } } } Meaning if connection string name value is missing in Module section in web.config file, the value should be read from configurationsection. How to do that?

    Read the article

  • ConfigurationSection with multiple projects

    - by shivesh
    In my asp.net solution i have a couple of class library-projects that act as modules of the site. In main project I have SiteConfigurationSection class that derives from ConfigurationSection. I want all projects to be able to access and use this SiteConfigurationSection. But class library projects can't access it because they obviously don't have a reference to the website itself. Should create a special library-project for SiteConfigurationSection of maybe it's better to create a mini SiteConfigurationSection class in every project and encapsulate only the needed values?

    Read the article

  • Retrieving substring of a bound value

    - by shivesh
    I am binding some data to control, but want to limit the number of character of a specific field to a 30 first characters. I want to do it, if it's possible, on aspx page. I tried this: Text='<%# String.Format("{0}", Eval("Title")).Substring(0,30) %> ' But got this error: Index and length must refer to a location within the string. Parameter name: length

    Read the article

  • Event triggering inside prototype

    - by shivesh
    When I try to call "Test" function I get an error. How to fix that? (no jquery!) Browser:firefox error: TypeError: this.Test is not a function <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> <script type="text/javascript"> MyClass = function(){ } MyClass.prototype = { Init: function(){ var txt = document.getElementById("text"); if (txt.addEventListener) { txt.addEventListener("keyup", this.Foo, true) } }, Foo: function(){ this.Test(); }, Test: function(){ alert('OK'); } } window.onload = function(){ obj = new MyClass; obj.Init(); } </script> </head> <body> <textarea id="text" rows="10"> </textarea> </div> </body>

    Read the article

  • firebug and _moz_dirty

    - by shivesh
    I am developing Javascript app that will wrap every line of text entered inside iframe (designmode) with P (or div) like it happens by default in IE. For now I am not pasting my code because I just started, the first problem is when i type some text in firefox and even before I click enter or calling any function firebug inserts <br _moz_dirty=""> under the entered text. Why? How can I prevent it? If you still need my code please tell.

    Read the article

  • Using Joins vs Entity associations

    - by shivesh
    I am learning Entity framework and linq-to-entities. It's possible to get cross values from multiple tables using JOINS (join keyword) or using the navigation fields ( associations) in which case the framework knows how to reference the cross data. My question is what to use when?

    Read the article

  • Adding iframe and paragraph elements dynamically

    - by shivesh
    I want to add iframe element to the page and then add <p> element inside that iframe. I tried this: var iframe = document.createElement('iframe'); iframe.frameBorder = 1; iframe.width = "500px"; iframe.height = "250px"; iframe.id = "iframe"; var p = document.createElement('p'); iframe.appendChild(p); document.getElementById("div").appendChild(iframe); //this is a div that I have in body.

    Read the article

1