.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

dropdownbox which selects records based on criteria (TODAY, THIS WEEK, THIS MONTH, etc)

Posted By:      Posted Date: August 23, 2010    Points: 0   Category :ASP.Net

I have a dropdownbox which I want to use to search records based on a timescale. The gridview populates results based from that search.

So here is how I want to work this;

If a user selects "today" - a list of records input today are populated. If "this week" is selected, a list of all records added within that week from todays date is populated.

I created a forum on this issue previously but to no avail whatsoever. How do I work around this problem?

Help would be much appreciated

View Complete Post

More Related Resource Links

SSAS Calendar Week commencing with split at month

Hi all, Wonder if someone can help. Our CFO wants to see a cube calendar that shows week commencing but stops at the end of month. For example if the dates are Monday  28th   Tuesday  29th   Wednesday 30th   Thursday 1st    Friday  2nd Saturday 3rd Sunday   4th So for this example the week commencing is the 28th of Month 1 and Thursday is week commencing 1st of the next. I am having a problem seeing how I can do this. If I add the weeks to a standard calendar I get the week commencing 28th which includes the 7 days, naturally. I cannot help feeling I am missing something obvious. Cheers

How i can view last 5 days records in current Month

Suppose i have a tableAppno Receive_Date Send_Date 1 9/3/2010 9/3/2010 2 9/3/2010 null 3 9/4/2010 9/4/2010 4 9/9/2010 9/9/2010 i m trying to run this select * from search where datediff(d,send_Date,getdate()<5

Inserting Records Based on Checkbox Selection in a Gridview

Using checkboxes, can the row of record(s) be inserted into a database? I am populating a Gridview. Done. A checkbox field has been added, when the user selects one or more rows, a submit button (which is not working) needs to inserting those records into a table. The insert statment will work outside of the page but is not working using the scenario I jut described. Is this task as I have outlined doable? txs Ayomide

populate dropdown based on attribute criteria

Trying to load a dropdown list with the 'name' attribute from the category node...must be missing something: The xml: <Settings>  <department name="Accounting">    <category name="Bank Information">    <category name="Form Information"></Settings>    The code I'm attempting: XmlDocument settingsdoc = new XmlDocument();                settingsdoc.Load(Server.MapPath("/XML/Settings.xml"));                XmlNodeList nodeList = doc.SelectNodes("Settings/department[name='Accounting']");                 foreach (XmlNode node in nodeList)                    CategoryDDL.Items.Add(new ListItem(node.SelectSingleNode("//department/category[name]").InnerText)); CategoryDDL.DataBind();   Any idea what looks wrong? Thanks!

delete node based on criteria - linq to xml


I'm trying to delete an element based on its inner text but seem to not quite have it...

I have an xml doc like this:
<department name="Claims">
    <MyElement>Big Test</MyElement>


My linq to xml is:

XDocument ldoc = XDocument.Load(Server.MapPath("/XML/Settings.xml"));

doc.Elements("department").Where(s => s.Element("keywords").Value == "phone").Remove();



When I click my link button the element <keywords>phone</keywords> is never deleted.

Any idea what i'm doing wrong?




Getting records that 7 days pass today's date


I want to get all records that are 7 days pass today's date and not equal to today's date.  Don't know how to write it so I can get records 7 days old but with this procedure I'm still getting records that are due today.  Hope this makes sense.  Can someone assist me.

select * from libraryrequest
where  duedate > getdate() and duedate != getdate()

Count of Rows - Records between month - T-SQL 2005


Hi Below is my Scenario.

Record                       Start Date                           END Date

  1                              01/02/2008                          04/05/2009

  2                             01/25/2008                           06/19/2009

  3                              02/02/2008                   

Last day of month and last day of the week Using MTD,YTD

How Can I achive Last day of month and last day of the week Using MTD,YTD function in SSAS Qube ?

select records within a week


i try to use select statement to select records within a week from orderdate. like,


"select * from order where orderdate <= DATEADD(day,7,orderdate)";


correct me if wrong.


SharePoint 2010 Approval workflow based on list criteria


Hello All

I have been requested to create an Approval workflow for a list with 3 columns - Title, Category and Price. The Category field has 3 options - Minor, Moderate and Major.

If the Category is Minor the approval is sent to the Project Manager, and after approval it is sent to the Manager for approval.

How can I accomplish this using SharePoint Designer 2010? Can I modify the OOTB approval workflow, if yes how?

What other options do I have? This is really urgent.

Thank you for any responses.




return records based on current date?


I tried finding a QA which already addressed this idea, but with no luck. Sorry if it's been addressed before.


I have a table where sales pricing is managed; it contains history of pricing where every price record has an 'effective date'. Currently when a user needs the 'active' price for a customer/item combination, the table is queried by the record that has the most recent 'EffectiveDate' before GETDATE(). Here is the def for table 'tim_PriceSheet'

ItemKey int, not null

EffectiveDate datetime, notnull

CurrID varchar(3)

ListPrice decimal (15,5)

The primary key is set on ItemKey, EffectiveDate

Sample Data:


ItemKey	EffectiveDate	    CurrID	ListPrice
45	2010-07-01 00:00:00.000	CAD	100.00000
45	2010-09-14 00:00:00.000	CAD	110.00000
45	2010-10-01 00:00:00.000	CAD	112.00000
63	2010-09-01 00:00:00.000	CAD	45.00000
63	2010-09-01 00:00:00.000	USD	45.00000
63	2010-09-18 00:00:00.000	CAD	40.00000
63	2010-10-01 00:00:00.000	USD	40.00000
63	2010-10-15 00:00:00.000	CAD	41.00000
63	2010-10-21 00:00:00.000	USD	41.00000

My challenge is this:

I want to return a record set which shows the current price for each distinct item and currency code; in the example below the result would be based on the date being September 16, 2010

Is there a way to query entity based on multiple filter criteria? WCF Data Services, Linq to Entiti


Instead of:

DW_CMSOPEN dwc = new DW_CMSOPEN(new Uri("http://acctdev02/WCFDataService/EmployeeService.svc"));

dwc.Credentials = System.Net.CredentialCache.DefaultCredentials;

var employees = from emp in dwc.Employees 
             where emp.DEPT == "123"
             select emp;

I'd like the linq query to resemble:

var employees = from emp in dwc.Employees
              where emp.DEPT // in {"123", "456", etc}
              select emp;

Routing of Records to a particular folder (in a hiearchy) based on contents of a metadata column


Hi, i'm looking for ideas to solve a problem that is roadblocking our sharepoint 2010 records management implementation.  We have set up our sharepoint 2010 records center to mimic our existing folder based records management system.  We would like to stamp each of our documents with a piece of meta data (called classification) which contains the path to the records center folder in which this document should reside.  Our users are familiar with this structure and we can setup defaults for a lot of documents so getting the value in the meta data is not a big issue.

The issue is that we would like to create a content organizer rule that would forward a document to a path defined in a meta data column to the matching column in the records center.  I don't beleive this is possible OOTB but i would love to be proven wrong.  I don't want to manually have to create a rule for every folder / meta data value combination because there are thousdand of folders in the existing records center folder.

I'm open to developing a custom solution to this problem (or hiring someone to doe this), however not sure where to start... use the content oganizer object or a sharepoint timer job?  Don't want to have to reinvent the wheel...

here is and example of what i mean by the metadata / folder pair



need of Ascending order based on the Date and month.


Hi friends,

query.Append("SELECT Name, Sex, Marital_Status, Dob, Anniversary, Mobile, Email FROM Client WHERE ");

            if (startDate > new DateTime() && endDate > new DateTime())
                query.Append("(DATEADD(YEAR,DATEDIFF(YEAR, DOB,'" + startDate + "'),DOB) BETWEEN '" + startDate + "'AND'" + endDate + "' OR DATEADD(YEAR,DATEDIFF(YEAR, ANNIVERSARY,'" + startDate + "'),ANNIVERSARY) BETWEEN '" + startDate + "'AND'" + endDate + "') AND ");
           if (!string.IsNullOrEmpty(maritalStatus) && !string.Equals("All", maritalStatus))
                query.Append(" Marital_Status = '" + maritalStatus + "'");

            string resultQuery = query.ToString();
            if (resultQuery.Trim().EndsWith("AND", StringComparison.OrdinalIgnoreCase))
                int lastIndex = resultQuery.LastIndexOf("AND");
                resultQuery = resultQuery.Remove(lastIndex, 3);

            if (resultQuery.Trim().EndsWith("WHERE"))
                int lastIndex = resultQuery.LastIndexOf("WHER

Calendar List View Issue - No Month, Week, Day Icons


I'm trying to setup a Calendar view for a list in SharePoint 2010. Everything is working the way I want, except there are no icons to change the view from Month, Week, or Day. Right now, if someone clicks on a date on the calendar, it switches to the Day view. But there is no way for them to go back to the month view.

I open the page in SharePoint Designer, and in the Design view I can see three icons on the Calendar (Month, Week, Day). But at no time do these icons show up anywhere except the design view.

I want it to have the arrow buttons, the month and year (which are already displaying) and then the icons to change the view. How do I get them to appear?

How to find records based on CAPITAL and small letters in SQL Query?



I stumbled upon this scenario at my work and it is really something I was not expecting. I know that in general SQL itself is not a CASE SENSITIVE language ... so it will not make any difference if i write select *, or SELECT * or SeLEct * ...

But recently I came across a situation where I am required to find results from a table where more than one record exists with just a difference of Captial and Small letter word. Let me explain my problem in detail,

I work for a government client, in one of their table they have list of all state statues and out of them some have exactly same string except in that string some letters are capitalized, e.g.  46b-12 (A) and 46b-12 (a) ... now my question is how can i write a query which can find only record that I search, e.g if I search select desc from statues where code='46b-12 (a)' ... it should find only one record not two.

ForeignKey display values based on criteria, metadata model


I have a table with 3 columns, {id,name,display}.  ID being primary key, Name being first string in table(dynamic data will populate any dropdown's with this value, unless overridden), and Display being a bit/boolean. 

I have a custom page(Master/Detail) created making use of asp:DynamicControl and asp:DynamicField.  Several of the associated Controls/Fields are ForeignKeys.  When editing/inserting the controls use the ForeignKey FieldTemplate.  Ideally, this works great!  However, I need a little bit more control over which data items get displayed from the database(selectable values).  This seems like it should be easy, yet, I cannot get my head around it. 

OBJECTIVE: When 'display' == true, show name in list.  When 'display' == false, do not show name in list. 

QUESTION: Is there a way to handle this within the metamodel using metadata attributes, etc...?  Please advise... 



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend