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

Top 5 Contributors of the Month
Post New Web Links

How to add conditions at XSD?

Posted By:      Posted Date: October 12, 2010    Points: 0   Category :ASP.Net


I have an XML file as follows: Just a sample file















The tag <Contact> can come any times in <Contacts>. i.e. User sends number of contact information. So we are not sure how many people information the client sends us. So, my requiremtn is:

Atleast 1 Contact tag <Type> data should be as 'B'. If user send, 10 Contact Info without Type B, we should not accept it. 

If user sends 10 Contact with 1 Type B, then thats fine. 

So, I need to check this condition at XSD itself. Contact Type is of string type. How can i Check this condition at

View Complete Post

More Related Resource Links

Unique content within master page based on conditions met


 Hi all-

I would like to present users with unique content based on certain conditions being met as they land on the home page (default.aspx).  The condition logic will be in the VB code behind Page Load event. The content will go in a content placeholder as specificed from the master page. 

However, the content change wouldn't be something small (ie making a panel or label visible or not) but rather it will be different HTML,  Divs and databound gridview content.  The HTML content will be stored in the database.

Can someone point me in the right direction for best practices on how to accomplish this?


Inserting rows via stored procedure and under certain conditions


I'm using Dynamic Data with Entity Framework in VS2010.

Let's say my table has these fields:

PersonID (FK)
LocationID (FK)

Hypothetical scenario (it's easier for me to explain this way, so just bear with me for now)... But let's say each row in the table represents "how many items were sold by such-and-such employee at such-and-such location," where location and person are foreign keys which are referencing other tables.  Basically, there should be no more than a ONE row which has a particular combination of Person and Location.  Makes sense?

So, when inserting new rows using my Dynamic Data app, the insert form displays editable fields for Person (dropdown), Location (dropdown), and Items Sold (textbox).  How do I prevent users from inserting another row into the table containing an already-existing combination of Person and Location?   How do I displaying useful feedback to them in the event that they DO attempt to do this?

I have several thoughts about this, but since I'm new to Dynamic Data, I'm not sure which way to go.  For example:

Option 1:  Use "cascading dropdowns" approach in the insert form and only pull in the "allowed" combinations of the two dropd

Toolbox: Database Documentation, API for Pre- and Post-Conditions, Blogs and More


In this month's column, Scott explores one-click database documentation, covers an API for pre- and post-conditions, takes a look at an interesting blog, and reviews the latest book about the ASP.NET MVC Framework.

Scott Mitchell

MSDN Magazine November 2009

Linq to sql does not return appropriate multiple result sets with "If exists" conditions in the stor


Hello All,

I have a stored proc that returns 4 resultsets, they are in the format.

ALTER PROCEDURE [dbo].[pGetManagerEmployeeSummaryDummy]

    @ManagerStaffID int,
    @PeriodID int



IF EXISTS (select 1 from dbo.temployee e
    inner join dbo.temployeedetail ed
        on e.staffindividualid = ed.staffindividualid
        and ed.periodid = @PeriodID  
    inner join Incentive.tRole r
        on rm.IncentiveRoleID = r.RoleID
    where ed.ManagerIndividualStaffID = @ManagerStaffID
    AND r.RoleID = 1) --Closer
        SELECT e.StaffIndividualID, e.LastName, e.FirstName, r.RoleName, e.xname, e.yname

from dbo.temployee e

inner join dbo.temployeedetail ed
            on e.staffindividualid = ed.staffindividualid
            and ed.periodid = @PeriodID

where ed.ManagerIndividualStaffID = @ManagerStaffID

Confirm message box on some conditions

Hi,In one of our application, after saving the data successfully we have to show the confirm message box whether to continue the process or not. On click of the yes i have to call one function.So how can i get confirm message box based on condition and how can i read the return value of the confirm message box to call other functions.Thanks in advance,Aruna

Case Statement Evaluating 2 Conditions

Hello, I have a field A and B. I want A to be filterered based a condition  When B= 2 then  A should not be in (1,2,3,4) When B=1 then give me back all of A (no filters) I am trying to do something like: Case when B=2 then A Not in (1,2,3,4) else A How do I incorporate this in my case statement? Or do I need some other way to do this? Please help. Thanks to all in advance! KJ

Hiding row tag on certain conditions

Hi, I am using Sharepoint Designer to hide <tr> tag(including it's child control) in my sharepoint page. The requirement is to hide <tr> tag if current page url is http://abc else it remain as it ll visible. I hv tried using Javascript, <script type="text/javascript"> <!-- function GetURL() { var URL =location.href; if(URL=="http://abc") { document.getElementbyId('test').style.visibility = 'hidden'; } } //--> </script>   ....In <BODY> part.... <tr id="test" runat="server" OnInit="GetURL();" > . . .     But this is giving an error ....") expencted" and "Invalid expression ter, ')'"    I tried using "OnLoad" attribute also but still not helping.... Any Suggetion whr I m doing wrong.....    

Question of replacement of if..else conditions with design pattern



I am working on an application which contains code in lot of places where certain objects are created based on certain condition. The code is something like the following:

if(affectedObject == "Customer")
     Customer c  = new Customer();
else if(affectedObject == "Salesman")
     SalesMan s = new SalesMan();

// or 

     case "Manager":
          // Do some processing.
     case "Employee":
          // Do another processing.


I have gone through design patterns once but I am not able to figure out how I can use a pattern to replace my code.

Can any one please help me with this? Any practical code sample would be of great help (code without refactoring and refactored code) so that I can understand it better.

Thanks in advance.

Miscrosoft SQL Server Analysis Service does not show conditions and calculated members



I am using MS visual studio 2005 to modify a report. The reports has got some filters (conditions) and calculated fields but when I open the report, all it shows me blanks values in condition window screen (where it displays Dimension, hierarchy, Operator, Filter Expression, Parameter fields) and also it does not display any calculated fields in the calculated members widnow. 

I am using SP1. Do I need to re-install the software or am I misisng some tool to turn on.

Thanks in Advance


Placing conditions on meta data


Is it possible to place conditions on the metadata for a document library?

ie:  document library.

Company Name
Purchase Order number

I want some fields to be required based on type (ie: if Type is "Spam" then some fields not required)

Can this be done in SPD? 


Default number of search conditions


Does anyone know if you can increase the number of search conditions in SharePoint from the default 5 to something more, 10 perhaps?  and if so, can this be done in SP2007 as well SP2010.

Thanks in advance...

Using a database to synchronize and co-ordinate processes on a web farm and avoid race conditions


A lot of actions in my ASP.NET app happen asynchronously (i.e in background threads without any access to HttpContext). Let me take an example of one such action. The app would be deployed to a web farm soon.

The background threads would be processing files deposited to a network share location. So, when the app starts, I create a FilesystemWatcher to monitor activities on the desired network share folder.

As soon as a new file arrives, the code processes it and marks it as completed processing.

The problem is with multiple servers watching the same network share, the same file might get processed on different machines, meaning redundant results. On a single server, I use locking mechanisms to prevent race conditions.

Now how to prevent the same on a web farm??

I was thinking of using a database to avoid such race conditions. So, when a server gets notified of a change to the network share, it requests a lock on a database object. Having granted the lock, it checks if the file has been processed and if not processes it, marks it as being processed and releases the lock. As all servers would be doing the same, they would not get into the processing logic for a file once it has been processed by another se

conditions to databound objects


I use a repeater on my website.

My code for this example is

  1. <ItemTemplate>
  2. Item: <%#DataBinder.Eval(Container.DataItem, "Col")%><br>
  3. </ItemTemplate>

Now, depending on the result of the dataitem will depend on what I want to display. For example, The databitem may show a true or false value, and depending on which one I want to show a different result on my page. So instead of it display true, it display a graphic.

At the moment, I am using a method to call a function (please correct my terminology - or let me know my terminology is right!).

  1. <ItemTemplate>
  2. Item: <%#CB(DataBinder.Eval(Container.DataItem, "Col"))%><br>
  3. </ItemTemplate>

code behind:

  1. public string&n

Error with calculated column having more than 30 conditions.


Hi ,

I am using calculated column with below conditions.

It would return: Yes if CC column contains either Jordan or Kuwait. Else it would return No .

It is working fine if I am using conditions of 3,4,5,6....30.

But if i am using more than 30 conditions it's showing me error:

The formula contains a syntax error or is not supported.


Please let me know if i am doing wrong anywhere or is it the limitation of SharePoint.


Using Conditions in InfoPath - How do I avoid getting NaN


Hi guys, I follow this article "Auto-numbering InfoPath forms when they are submitted to a SharePoint form library" to create an auto-numbering form. The tutorial is great but if the library is empty I received a "NaN".  They provide a solution but I don't know how to implement it. This is:


Add a Button to the form with the following 4 rules:

1.       Query the RetrieveIDs data connection

Is that available (Linq Query with Infinite number of conditions) ?


Hello all ,


is that available to make dynamic query with LINQ ? 

to be more clear 

i have a query like this 

 IEnumerable<XElement> query = xDoc.Elements("Disorder").Where(d => d.Elements("Tuple").Any(t => (string)t == "TupleA") && d.Elements("Tuple").Any(t => (string)t == "TupleB"));

this query has Where with 3 Conditions 

i want it to be dynamic and take infinite number of conditions ? 

is that available or i have to find another way to retrieve my data ?

or anyone knows better way to get data ?

Kareem Naguib

How to add Conditions in Radio Button


I am rookie in SharePoint , I am using Sharepoint Designer 2007 to create an survey. I created survey in my team site and went to Designer to Customize it. I have all the customizations done but i am stuck at one issue.

 My issue is I have a question  in my survey which has "Yes" and "No" Radio Button. If chosen Yes I should spit out other question, if chosen "No" go to other question.


How Do I Do this in Sharepoint Designer can anyone help me i would really appreciate it ,




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