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

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

Simple Question

Posted By:      Posted Date: September 02, 2010    Points: 0   Category :ASP.Net
hi i m using Resource file for localization everything cool I pick the date value and i format it then i set the HtmlTableCell InnerText value the date value shows in Thai format i don't want to show the date in thai language format how can i prevent this 

View Complete Post

More Related Resource Links

Entity framework simple question




First I am newbie using EF - so sorry on this basic question


I have a Project Table that relate to Company Table


When I Map with EF I Do not have property of CompanyId in the Project Object

But I have related Company Object


For example

Project p = new Project();

p.CompanyId è does not exist!

When I try addingit myself I get this error:

If I need just the Company id, and I don't want get it like

p.Company.CompanyId - because than the application try connect again to the DB and I don't want this, because I need just the CompanyId.

What the best regular way to get it?


A simple Data Modeling Question


I have a data modeling question that hopefully this fictious example will help explain.  My application is data driven and the classes reflect the tables to a large degree.   In this example my database has two tables:

  • VendorMaster with an int Primary Key of VendorID
  • VendorContact with an int Primary Key of ContactID

The VendorContact table also has a Foreign Key of VendorID in order to associate the contact with a specific Vendor.  In this example a Vendor can only have one contact.

My question is how to represent these two tables in terms of classes.  In my current design I have two classes:

  • VendorMaster
  • VendorContact

In order to represent the relationship between a VendorMaster and VendorContact, my VendorMaster class contains a property called VendorContact.

My questions are about the VendorContact class and how it represents the relationship between a VendorMaster and itself.

Option #1

The VendorContact class should contain an int property of VendorID

Option #2

The VendorContact class should contain a VendorMaster Property

I am not sure which option is the 'best' option to take. My concern is that if I go with option #2 that I would create a cyclical relationship between the VendorMaster and Vendo

GridView Question - Please Help Me...Should Be Simple...

Hello,I have what I think should be a simple GridView question but I can't find the answer.When I want to update a row in Gridview I click on the "Edit" link.  It takes me into the row of the GridView where I can edit the values.Here's how it looks:   CustomerID CompanyName Edit 001 IBM Microsoft Apple Google Edit 002 IBM Microsoft Apple Google Edit 003 IBM Microsoft Apple Google Edit 004 IBM Microsoft Apple Google When I click on "Edit" it looks like:   CustomerID CompanyName Edit 001 IBM Microsoft Apple Google Update Cancel IBM Microsoft Apple Google Edit 003 IBM Microsoft Apple Google Edit 004 IBM Microsoft Apple Google As you can see, I now have the ability to update the CustomerID.  I don't the user to be able to update the CustomerID, only the CompanyName via the DropDown.How can I change the GridView to ONLY allow me to update the CompanyName?ThanksJason   CustomerID CompanyName Edit 001 IBM Microsoft Apple Google Edit 002 IBM Microsoft Apple Google Edit 003 IBM Microsoft Apple Google Edit 004 IBM Microsoft Apple Google

Simple data binding question

Newbie binding question here: is it possible to bind a control in XAML to a StaticResource by passing in the key via a data structure? Basically something like this: <TextBlock Text="{Binding ImageKey}" /> <Image Source="{StaticResource ResourceKey={Binding ImageKey}}" /> <-- doesn't work   The TextBlock binding on the first line works correctly, it extracts the key of the StaticResource from my data structure and displays it correctly. What I'm trying to do is get the Image control to bind to the StaticResource with that name (which happens to be a BitmapImage).      

Simple Viewstate question

Consider a page with asp textbox and a button. textbox's "EnableViewstate" property is set as "False". In page directive also i set the Page's "EnableViewstate" property as "False". If i type some text (i.e., like "This is sample text") on the text box and click the command button. After the postback also that text box contains the same text ("This is sample text") which i have typed. I have set the view state in page for false. Then how the state is maintained?  whats the reason behind that? Thank you.

Simple Question

 Hi Guys,    I had a webservice method, Whenever it throws an Exception Object, I justwant to catch that Exception Object from the AJAX function. Is it possible? If so, please give sample code snippet ASAP.  Thanks in advance.

Simple question.... LINQ on Datatable

Hi all,Simple one this I am sure for those who use LINQ! :)I basically have two tables that will be stored in viewstate until I save the data to the database.  I need a way to query the datatables, delete remove etc.  Is this possible in LINQ?So for example, delete/select rows from the DataTable that have a particular ID etc...Thanks,Mark

Another Simple Question - Adding a Picture to My Site

Hi, I'm trying to add a profile picture to my profile on SharePoint 2010 but under Edit my profile there isn't a option. I believe it should normally be under Basic Information. Is there a way to add this option?

Simple Excel Import Question

I have an excel file I am importing into a table. The excel file is named with a date (02102010_Excel_file.xls). I created a very simple import package. This simple two object package - Excel Source to OLE DB destination works just fine. But..   My problem is that the Excel file name will change every day to todays date (09162010_ExcelFile.xls) So,  I need to change my Excel Import  to something like *.xls but that doesn't work. How can I Import a *.xls file? qeqw

Simple but unusual SQL 2008 peer2peer replication concept and question

Hi, I am not an SQL expert, but have to set up 3 remote SQL databases that need to be synchronised with each other. This is unusual because the locations are tiny atolls in the middle of the Pacific.  Communication between them is by satellite only which has limited bandwidth and is expensive.  The total population (thats all the people) on each atoll is only 500.  There is likely to be a maximum of 40 potential users per atoll and each SQL database is for internet login authentication only (Radius).  So the databases are tiny and have a very low update rate. What is the simplest way to synchronise the databases?  Doing this just once each night at around 4:00am would be best.  Peer to peer replication sounded right, but I do not want our extremely limited bandwidth taken up by this traffic when all we need is for the databases to be synchronised by the next day.  Also we are running MS SQL 2008 R2 Workshop edition and I am reading that this does not support peer2peer replication. The hardware is a laptop - since hot moisture laden salty air is very corrosive for traditional servers and power is intermittant at best.  Each atoll gets an identical system. Can anyone suggest a solution or ideas?  I am happy yo answer questions.  Thank you.

Simple question about indexing

Hi, Let's say I have a table that looks like this: StudentID int, PK FirstName varchar(50) not null LastName varchar(50) not null Score tinyint not null My question is this: if I'll be using the "Score" column in my SELECT statements such as MAX(Score) or SCORE > 75, etc. do I need to create an index for the Score column? Thanks, Sam

Simple drill through action question


Im using the the below query as the condition for a Drillthrough Action

IIF([Load Date].[LoadDate].CURRENTMEMBER IS [Load Date].[LoadDate].LastChild, TRUE, FALSE)

I am attempting to confine this action to the last loaddate member. I'm thinking this is fairly easy to do, but I cannot seem to get it to work. I haven't been doing MDX for a couple years now so I'm probably missing something simple...? Thanks for any assistance.


Simple SqlDataReader question


Do I only need to close the datareader on mydr.Read()  or also when I Execute the SqlDataReader without using mydr.Read()?  Would this Close in the following example be unnecessary?

Using mydr As SqlDataReader = mycmd.ExecuteReader()
End Using

    Thanks in advance..


Simple Question About Manipulating the ITextSelection of the IWpfTextView




I'm fiddling around with VS Extensibility and am trying to interact with the WpfTextView.


I'm struggling slightly getting to grips with the new model. Basically all I want to do is change the selected text (equivalent to TextSelection.CharLeft(true,1); using the older TextSelection object). This should be a case of interacting with some aspect of my IWpfTextView object's Selection property. But I can't work out which. 


How do I do this with the new model?



Simple JS question (dates)


I've 'inherited'  a website and although I'm happy with the .NET side of things I know very little about Javascript.  I've a simple validation function that isn't working.  I need to check that a date entered in a field is not after today.  The rest of the site is written in such away as to be culture aware and as such I don't have any hard coded date formats anywhere else.  Can I achieve this validation in JS without hard coding a date format?  Here's the code:

 function checkDate(src, args)
         var Received = document.getElementById('<%= txtTimeReceived.ClientID %>').value;
         var date_Received = new Date(Received);
         var currentTime = new Date();
       if (date_Received > currentTime )

Simple LINQ to SQL question


Someone help me with what I'm missing here...

I have a VERY simple file as you can see... just three tables.


The Problem is that if I do this somethign like this....

var patients = from x in db.CT_Patients
                     where x.CT_Visits...... (error here)


It doesn't display child properties for CT_Visits from CT_Patient like it should. I only get the standard LINQ queries like Select, Where, Orderby etc... What am I missing???


MVC simple question


I am using this book http://www.wrox.com/WileyCDA/WroxTitle/Professional-ASP-NET-MVC-2.productCd-0470643188.html
I discuss with author Project call NerDinner

there is 2 table Dinners and RVSP stored some information

author tries to retrive information from Dinners table with this function whic is written in Model Folder Class DinnerRepository:
here is:

public class DinnerRepository {

      private NerdDinnerEntities entities=new NerdDinnerEntities();

      public IQueryable<Dinner> FindUpcomingDinners() {
          return from dinner in entities.Dinners
                     select dinner;

 public class DinnersController : Controller {
         DinnerRepository dinnerRepository= new DinnerRepository();

         public ActionResult Index() {
            var dinners = dinnerRepository.FindUpcomingDinners().ToList();
            return View("Index", dinners);

when I run this solution there is an error: The model item passed into the dictionary is of type 
'System.Collections.Generic.List`1[NerDinner.Models.Dinner]', but this 
dictionary requires a model item of type 
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