Search Results

Search found 311 results on 13 pages for 'edward boyle'.

Page 6/13 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • WPF XAML: how to get StackPanel's children to fill maximum space downward?

    - by Edward Tanguay
    I simply want flowing text on the left, and a help box on the right. The help box should extend all the way to the bottom. If you take out the outer StackPanel below it works great. But for reasons of layout (I'm inserting UserControls dynamically) I need to have the wrapping StackPanel. How do I get the GroupBox to extend down to the bottom of the StackPanel, as you can see I've tried: VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" Height="Auto" XAML: <Window x:Class="TestDynamic033.Test3" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Test3" Height="300" Width="600"> <StackPanel VerticalAlignment="Stretch" Height="Auto"> <DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="Auto" Margin="10"> <GroupBox DockPanel.Dock="Right" Header="Help" Width="100" Background="Beige" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" Height="Auto"> <TextBlock Text="This is the help that is available on the news screen." TextWrapping="Wrap" /> </GroupBox> <StackPanel DockPanel.Dock="Left" Margin="10" Width="Auto" HorizontalAlignment="Stretch"> <TextBlock Text="Here is the news that should wrap around." TextWrapping="Wrap"/> </StackPanel> </DockPanel> </StackPanel> </Window> Answer: Thanks Mark, using DockPanel instead of StackPanel cleared it up. In general, I find myself using DockPanel more and more now for WPF layouting, here's the fixed XAML: <Window x:Class="TestDynamic033.Test3" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Test3" Height="300" Width="600" MinWidth="500" MinHeight="200"> <DockPanel VerticalAlignment="Stretch" Height="Auto"> <DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="Auto" MinWidth="400" Margin="10"> <GroupBox DockPanel.Dock="Right" Header="Help" Width="100" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" Height="Auto"> <Border CornerRadius="3" Background="Beige"> <TextBlock Text="This is the help that is available on the news screen." TextWrapping="Wrap" Padding="5"/> </Border> </GroupBox> <StackPanel DockPanel.Dock="Left" Margin="10" Width="Auto" HorizontalAlignment="Stretch"> <TextBlock Text="Here is the news that should wrap around." TextWrapping="Wrap"/> </StackPanel> </DockPanel> </DockPanel> </Window>

    Read the article

  • Why does this silverlight code get a "catastrophic failure" when reading a BitmapImage out of Isolat

    - by Edward Tanguay
    In a Silverlight app, I save a Bitmap like this: public static void SaveBitmapImageToIsolatedStorageFile(OpenReadCompletedEventArgs e, string fileName) { using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication()) { using (IsolatedStorageFileStream isfs = new IsolatedStorageFileStream(fileName, FileMode.Create, isf)) { Int64 imgLen = (Int64)e.Result.Length; byte[] b = new byte[imgLen]; e.Result.Read(b, 0, b.Length); isfs.Write(b, 0, b.Length); isfs.Flush(); isfs.Close(); isf.Dispose(); } } } and read it back out like this: public static BitmapImage LoadBitmapImageFromIsolatedStorageFile(string fileName) { string text = String.Empty; using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication()) { if (!isf.FileExists(fileName)) return null; using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication()) { using (IsolatedStorageFileStream isoStream = isoStore.OpenFile(fileName, FileMode.Open)) { BitmapImage bitmapImage = new BitmapImage(); bitmapImage.SetSource(isoStream); return bitmapImage; // "Catastrophic Failure: HRESULT: 0x8000FFFF (E_UNEXPECTED))" } } } } but this always gives me a "Catastrophic Failure: HRESULT: 0x8000FFFF (E_UNEXPECTED))" error. I've seen this error before when I tried to read a png file* off a server which was actually a **text file, so I assume the Bitmap is not being saved correctly, I got the code here. Can anyone see how the BitmapImage is not being saved correctly? Or why it would be giving me this error?

    Read the article

  • Can two Silverlight applications share IsolatedStorage on one machine?

    - by Edward Tanguay
    What identifies an application and when can two applications share IsolatedStorage if at all, i.e.: if I want to have two Silverlight applications share IsolatedStorage space, is this possible? What kind of "application id" do I need to give to do this? if I don't want two Silverlight applications to share IsolatedStorage, how do I prevent this? Do I need to do this? For instance, I've noticed when I develop a Silverlight application, I can press F5, in the application save to Isolated Storage, stop the application, press F5 again, and it reads from the same IsolatedStorage. (I would think that a new compilation would cause it to use new IsolatedStorage.) However, when I then copy the .xap and .html files to another directory and open the .html file, it does NOT share the IsolatedStorage with the application I was developing. What changed? What is going on behind the scenes here so I know when IsolatedStorage is shared and when it isn't?

    Read the article

  • How to implement search on jqgrid?

    - by Edward Tanguay
    So I've got basic example of jqgrid working in ASP.NET MVC, the javascript looks like this: $(document).ready(function() { $("#list").jqGrid({ url: '../../Home/Example', datatype: 'json', myType: 'GET', colNames: ['Id', 'Action', 'Parameters'], colModel: [ { name: 'id', index: 'id', width: 55, resizable: true }, { name: 'action', index: 'action', width: 90, resizable: true }, { name: 'paramters', index: 'parameters', width: 120, resizable: true}], pager: $('#pager'), rowNum: 10, rowList: [10, 20, 30], sortname: 'id', sortorder: 'desc', viewrecords: true, multikey: "ctrlKey", imgpath: '../../themes/basic/images', caption: 'Messages' }); Now I am trying to implement the search button that they have in the jqgrid examples (click on Manipulating/Grid Data). But I don't see how they implement it. I'm expecting e.g. a "search:true" and a method to implement it. Has anyone implemented search on jqgrid or know of examples that show explicitly how to do it?

    Read the article

  • How to use a App.config file in WPF applications?

    - by Edward Tanguay
    I created a App.config file in my WPF application: <?xml version="1.0" encoding="utf-8" ?> <configuration> <appsettings> <add key="xmlDataDirectory" value="c:\testdata"/> </appsettings> </configuration> Then I try to read the value out with this: string xmlDataDirectory = ConfigurationSettings.AppSettings.Get("xmlDataDirectory"); But it says this is obsolete and that I should use ConfigurationManager which I can't find, even searching in the class view. Does anyone know how to use config files like this in WPF?

    Read the article

  • What does Silverlight 4 Tools only give partial intellisense?

    - by Edward Tanguay
    I finally got Silverlight 4 Toolkit installed , referenced and working after the difficulty of finding the right namespace described in this question. But intellisense doesn't work fully: after I type "tk:", it doesn't pop up the various controls I have available, but if I type a control name out, e.g. DockPanel, then it works, as shown below. It will even give me intellisense after I type tk:DropPanel, which is odd. How can I get intellisense to work in all cases for the Silverlight 4 Toolkit?

    Read the article

  • How do you change the allowDefinition section attribute using appcmd in IIS 7?

    - by Edward Wilde
    Is it possible to use appcmd to change the value of allowDefinition? Specifically I'm try to enable changes to the httpCompression module at the application level. Modifying the applicationHost.config by manually changing the following line: <section name="httpCompression" allowDefinition="AppHostOnly" overrideModeDefault="Deny" /> To <section name="httpCompression" allowDefinition="MachineToApplication" overrideModeDefault="Allow" /> allows me to then execute the following appcmd commands: appcmd set config "website name" /section:httpCompression /noCompressionForProxies:false appcmd set config "website name" /section:httpCompression /noCompressionForHttp10:false However I need a solution that does not rely on manually editing the applicationHost.config

    Read the article

  • How to convert this code-based WPF tooltip to Silverlight?

    - by Edward Tanguay
    The following ToolTip code works in WPF. I'm trying to get it to work in Silverlight. But it gives me these errors: TextBlock does not contain a definition for ToolTip. Cursors does not contain a definition for Help. ToolTipService does not contain a definition for SetInitialShowDelay. How can I get this to work in Silverlight? using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; namespace TestHover29282 { public partial class Window1 : Window { public Window1() { InitializeComponent(); AddCustomer("Jim Smith"); AddCustomer("Joe Jones"); AddCustomer("Angie Jones"); AddCustomer("Josh Smith"); } void AddCustomer(string name) { TextBlock tb = new TextBlock(); tb.Text = name; ToolTip tt = new ToolTip(); tt.Content = "This is some info on " + name + "."; tb.ToolTip = tt; tt.Cursor = Cursors.Help; ToolTipService.SetInitialShowDelay(tb, 0); MainStackPanel.Children.Add(tb); } } }

    Read the article

  • Intellisense fails for boost::shared_ptr with Boost 1.40.0 in Visual Studio 2008

    - by Edward Loper
    I'm having trouble getting intellisense to auto-complete shared pointers for boost 1.40.0. (It works fine for Boost 1.33.1.) Here's a simple sample project file where auto-complete does not work: #include <boost/shared_ptr.hpp> struct foo { bool func() { return true; }; }; void bar() { boost::shared_ptr<foo> pfoo; pfoo.get(); // <-- intellisense does not autocomplete after "pfoo." pfoo->func(); // <-- intellisense does not autocomplete after "pfoo->" } When I right-click on shared_ptr, and do "Go to Definition," it brings be to a forward-declaration of the shared_ptr class in . It does not bring me to the actual definition, which is in However, it compiles fine, and auto-completion works fine for "boost::." Also, auto-completion works fine for boost::scoped_ptr and for boost::shared_array. Any ideas?

    Read the article

  • How can I get a Silverlight application to check for an update without the user clicking a button?

    - by Edward Tanguay
    I have made an out-of-browser silverlight application which I want to automatically update every time there is a new .xap file uploaded to the server. When the user right-clicks the application and clicks on Updates, the default is set to "Check for updates, but let me choose whether to download and install them": This leads me to believe that it is possible to make my Silverlight application automatically detect if there is a new .xap file present on the server, and if there is, the Silverlight client will automatically ask the user if he would like to install it. This however is not the case. I upload a new .xap file and the Silverlight application does nothing. Even if I add this to my App.xaml.cs: -- private void Application_Startup(object sender, StartupEventArgs e) { this.RootVisual = new BaseApp(); if (Application.Current.IsRunningOutOfBrowser) { Application.Current.CheckAndDownloadUpdateAsync(); } } and update the .xap file, the Silverlight application does nothing. This information leads me to believe that I have to make a button which the user clicks to see if there is an update. But I don't want the user to have to click a button every day to see if there is an update. I want the application to check by itself if there is a new .xap file and if there is, let the client ask the user if he wants the update. How do I make my Silverlight application check, each time it starts, if there is a new .xap file, and if there is, pass control to the Silverlight client to ask the user if he wants to download it, as the above dialogue implies is possible?

    Read the article

  • Using Timthumb to Resize Images from CKEditor

    - by Edward Coleridge Smith
    I am using CKEditor to do basic text and image input into my website. I have noticed that it is quite sporadic in it's method of generating HTML for images when you add them. (Sometimes it might use height and width tags, other times it might use CSS). I use Timthumb for on the fly image resizing on a number of other websites and find it very useful. I use a mod_rewrite rule in my .htaccess file to allow me to create domains like http://localhost/images/800x600/image.jpg and achieve resizing. I would like to somehow incorporate this into CKEditor. I cannot find how to do this looking through the documentation so I have tried post-processing the data produced by CKEditor using Regex, however as mentioned before CKEditor seems to be too sporadic to be able to get this to work all the time. Anyone else done this before? How did you achieve it?

    Read the article

  • How can I import a text file into javascript from an external website using jquery $get()?

    - by Edward Tanguay
    When the button in the following script gets clicked, it should load in the contents of the file "http://tanguay.info/knowsite/data.txt" and display it on the screen. What is the correct syntaxt so that the .get() function retrieves the data from the external website and puts it in #content? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("jquery", "1.3.2"); google.setOnLoadCallback(function() { $('#toggleButton').click(loadDataFromExernalWebsite); }); function loadDataFromExernalWebsite() { $('#content').html('new content'); //$.get("http://tanguay.info/knowsite/data.txt", function(data) { alert(data); }, ); } </script> </head> <body> <p>Click the button to load content:</p> <p id="content"></p> <input id="toggleButton" type="button" value="load content"/> </body> </html>

    Read the article

  • Is there a better way than this to find out if an IsolatedStorage file exists or not?

    - by Edward Tanguay
    I'm using IsolatedStorage in a Silverlight application for caching, so I need to know if the file exists or not which I do with the following method. I couldn't find a FileExists method for IsolatedStorage so I'm just catching the exception, but it seems to be a quite general exception, I'm concerned it will catch more than if the file doesn't exist. Is there a better way to find out if a file exists in IsolatedStorage than this: public static string LoadTextFromIsolatedStorageFile(string fileName) { string text = String.Empty; using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication()) { try { using (IsolatedStorageFileStream isfs = new IsolatedStorageFileStream(fileName, FileMode.Open, isf)) { using (StreamReader sr = new StreamReader(isfs)) { string lineOfData = String.Empty; while ((lineOfData = sr.ReadLine()) != null) text += lineOfData; } } return text; } catch (IsolatedStorageException ex) { return ""; } } }

    Read the article

  • Big smart ViewModels, dumb Views, and any model, the best MVVM approach?

    - by Edward Tanguay
    The following code is a refactoring of my previous MVVM approach (Fat Models, skinny ViewModels and dumb Views, the best MVVM approach?) in which I moved the logic and INotifyPropertyChanged implementation from the model back up into the ViewModel. This makes more sense, since as was pointed out, you often you have to use models that you either can't change or don't want to change and so your MVVM approach should be able to work with any model class as it happens to exist. This example still allows you to view the live data from your model in design mode in Visual Studio and Expression Blend which I think is significant since you could have a mock data store that the designer connects to which has e.g. the smallest and largest strings that the UI can possibly encounter so that he can adjust the design based on those extremes. Questions: I'm a bit surprised that I even have to "put a timer" in my ViewModel since it seems like that is a function of INotifyPropertyChanged, it seems redundant, but it was the only way I could get the XAML UI to constantly (once per second) reflect the state of my model. So it would be interesting to hear anyone who may have taken this approach if you encountered any disadvantages down the road, e.g. with threading or performance. The following code will work if you just copy the XAML and code behind into a new WPF project. XAML: <Window x:Class="TestMvvm73892.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:TestMvvm73892" Title="Window1" Height="300" Width="300"> <Window.Resources> <ObjectDataProvider x:Key="DataSourceCustomer" ObjectType="{x:Type local:CustomerViewModel}" MethodName="GetCustomerViewModel"/> </Window.Resources> <DockPanel DataContext="{StaticResource DataSourceCustomer}"> <StackPanel DockPanel.Dock="Top" Orientation="Horizontal"> <TextBlock Text="{Binding Path=FirstName}"/> <TextBlock Text=" "/> <TextBlock Text="{Binding Path=LastName}"/> </StackPanel> <StackPanel DockPanel.Dock="Top" Orientation="Horizontal"> <TextBlock Text="{Binding Path=TimeOfMostRecentActivity}"/> </StackPanel> </DockPanel> </Window> Code Behind: using System; using System.Windows; using System.ComponentModel; using System.Threading; namespace TestMvvm73892 { public partial class Window1 : Window { public Window1() { InitializeComponent(); } } //view model public class CustomerViewModel : INotifyPropertyChanged { private string _firstName; private string _lastName; private DateTime _timeOfMostRecentActivity; private Timer _timer; public string FirstName { get { return _firstName; } set { _firstName = value; this.RaisePropertyChanged("FirstName"); } } public string LastName { get { return _lastName; } set { _lastName = value; this.RaisePropertyChanged("LastName"); } } public DateTime TimeOfMostRecentActivity { get { return _timeOfMostRecentActivity; } set { _timeOfMostRecentActivity = value; this.RaisePropertyChanged("TimeOfMostRecentActivity"); } } public CustomerViewModel() { _timer = new Timer(CheckForChangesInModel, null, 0, 1000); } private void CheckForChangesInModel(object state) { Customer currentCustomer = CustomerViewModel.GetCurrentCustomer(); MapFieldsFromModeltoViewModel(currentCustomer, this); } public static CustomerViewModel GetCustomerViewModel() { CustomerViewModel customerViewModel = new CustomerViewModel(); Customer currentCustomer = CustomerViewModel.GetCurrentCustomer(); MapFieldsFromModeltoViewModel(currentCustomer, customerViewModel); return customerViewModel; } public static void MapFieldsFromModeltoViewModel(Customer model, CustomerViewModel viewModel) { viewModel.FirstName = model.FirstName; viewModel.LastName = model.LastName; viewModel.TimeOfMostRecentActivity = model.TimeOfMostRecentActivity; } public static Customer GetCurrentCustomer() { return Customer.GetCurrentCustomer(); } //INotifyPropertyChanged implementation public event PropertyChangedEventHandler PropertyChanged; private void RaisePropertyChanged(string property) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(property)); } } } //model public class Customer { public string FirstName { get; set; } public string LastName { get; set; } public DateTime TimeOfMostRecentActivity { get; set; } public static Customer GetCurrentCustomer() { return new Customer { FirstName = "Jim", LastName = "Smith", TimeOfMostRecentActivity = DateTime.Now }; } } }

    Read the article

  • Why does Silverlight 4 Tools only give partial intellisense?

    - by Edward Tanguay
    I finally got Silverlight 4 Toolkit installed , referenced and working after the difficulty of finding the right namespace described in this question. But intellisense doesn't work fully: after I type "tk:", it doesn't pop up the various controls I have available, but if I type a control name out, e.g. DockPanel, then it works, as shown below. It will even give me intellisense after I type tk:DropPanel, which is odd. How can I get intellisense to work in all cases for the Silverlight 4 Toolkit? I can imagine I need another namespace, but this site says that this reference: is now all you need (and will be automatically used by both Visual Studio and Blend)

    Read the article

  • Why isn't my WPF Datagrid showing data?

    - by Edward Tanguay
    This walkthrough says you can create a WPF datagrid in one line but doesn't give a full example. So I created an example using a generic list and connected it to the WPF datagrid, but it doesn't show any data. What do I need to change on the code below to get it to show data in the datagrid? ANSWER: This code works now: XAML: <Window x:Class="TestDatagrid345.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:toolkit="http://schemas.microsoft.com/wpf/2008/toolkit" xmlns:local="clr-namespace:TestDatagrid345" Title="Window1" Height="300" Width="300" Loaded="Window_Loaded"> <StackPanel> <toolkit:DataGrid ItemsSource="{Binding}"/> </StackPanel> </Window> Code Behind: using System.Collections.Generic; using System.Windows; namespace TestDatagrid345 { public partial class Window1 : Window { private List<Customer> _customers = new List<Customer>(); public List<Customer> Customers { get { return _customers; }} public Window1() { InitializeComponent(); } private void Window_Loaded(object sender, RoutedEventArgs e) { DataContext = Customers; Customers.Add(new Customer { FirstName = "Tom", LastName = "Jones" }); Customers.Add(new Customer { FirstName = "Joe", LastName = "Thompson" }); Customers.Add(new Customer { FirstName = "Jill", LastName = "Smith" }); } } }

    Read the article

  • Why does KeyDown event not have access to the current value of bound variable?

    - by Edward Tanguay
    In the example below: I start program, type text, click button, see text above. Press ENTER see text again. BUT: I start program, type text, press ENTER, see no text. It seems that the KeyDown event doesn't get access to the current value of the bound variable, as if it is always "one behind". What do I have to change so that when I press ENTER I have access to the value that is in the textbox so I can add it to the chat window? XAML: <Window x:Class="TestScroll.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="290" Width="300" Background="#eee"> <StackPanel Margin="10"> <ScrollViewer Height="200" Width="260" Margin="0 0 0 10" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"> <TextBlock Text="{Binding TextContent}" Background="#fff"/> </ScrollViewer> <StackPanel HorizontalAlignment="Left" Orientation="Horizontal"> <TextBox x:Name="TheLineTextBox" Text="{Binding TheLine}" Width="205" Margin="0 0 5 0" KeyDown="TheLineTextBox_KeyDown"/> <Button Content="Enter" Click="Button_Click"/> </StackPanel> </StackPanel> </Window> Code-Behind: using System; using System.Windows; using System.Windows.Input; using System.ComponentModel; namespace TestScroll { public partial class Window1 : Window, INotifyPropertyChanged { #region ViewModelProperty: TextContent private string _textContent; public string TextContent { get { return _textContent; } set { _textContent = value; OnPropertyChanged("TextContent"); } } #endregion #region ViewModelProperty: TheLine private string _theLine; public string TheLine { get { return _theLine; } set { _theLine = value; OnPropertyChanged("TheLine"); } } #endregion public Window1() { InitializeComponent(); DataContext = this; TheLineTextBox.Focus(); } private void Button_Click(object sender, RoutedEventArgs e) { AddLine(); } void AddLine() { TextContent += TheLine + Environment.NewLine; } private void TheLineTextBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Return) { AddLine(); } } #region INotifiedProperty Block public event PropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged(string propertyName) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(propertyName)); } } #endregion } }

    Read the article

  • NerdDinner form validation DataAnnotations ERROR in MVC2 when a form field is left blank.

    - by Edward Burns
    Platform: Windows 7 Ultimate IDE: Visual Studio 2010 Ultimate Web Environment: ASP.NET MVC 2 Database: SQL Server 2008 R2 Express Data Access: Entity Framework 4 Form Validation: DataAnnotations Sample App: NerdDinner from Wrox Pro ASP.NET MVC 2 Book: Wrox Professional MVC 2 Problem with Chapter 1 - Section: "Integrating Validation and Business Rule Logic with Model Classes" (pages 33 to 35) ERROR Synopsis: NerdDinner form validation ERROR with DataAnnotations and db nulls. DataAnnotations in sample code does not work when the database fields are set to not allow nulls. ERROR occurs with the code from the book and with the sample code downloaded from codeplex. Help! I'm really frustrated by this!! I can't believe something so simple just doesn't work??? Steps to reproduce ERROR: Set Database fields to not allow NULLs (See Picture) Set NerdDinnerEntityModel Dinner class fields' Nullable property to false (See Picture) Add DataAnnotations for Dinner_Validation class (CODE A) Create Dinner repository class (CODE B) Add CREATE action to DinnerController (CODE C) This is blank form before posting (See Picture) This null ERROR occurs when posting a blank form which should be intercepted by the Dinner_Validation class DataAnnotations. Note ERROR message says that "This property cannot be set to a null value. WTH??? (See Picture) The next ERROR occurs during the edit process. Here is the Edit controller action (CODE D) This is the "Edit" form with intentionally wrong input to test Dinner Validation DataAnnotations (See Picture) The ERROR occurs again when posting the edit form with blank form fields. The post request should be intercepted by the Dinner_Validation class DataAnnotations. Same null entry error. WTH??? (See Picture) See screen shots at: http://www.intermedia4web.com/temp/nerdDinner/StackOverflowNerdDinnerQuestionshort.png CODE A: [MetadataType(typeof(Dinner_Validation))] public partial class Dinner { } [Bind(Include = "Title, EventDate, Description, Address, Country, ContactPhone, Latitude, Longitude")] public class Dinner_Validation { [Required(ErrorMessage = "Title is required")] [StringLength(50, ErrorMessage = "Title may not be longer than 50 characters")] public string Title { get; set; } [Required(ErrorMessage = "Description is required")] [StringLength(265, ErrorMessage = "Description must be 256 characters or less")] public string Description { get; set; } [Required(ErrorMessage="Event date is required")] public DateTime EventDate { get; set; } [Required(ErrorMessage = "Address is required")] public string Address { get; set; } [Required(ErrorMessage = "Country is required")] public string Country { get; set; } [Required(ErrorMessage = "Contact phone is required")] public string ContactPhone { get; set; } [Required(ErrorMessage = "Latitude is required")] public double Latitude { get; set; } [Required(ErrorMessage = "Longitude is required")] public double Longitude { get; set; } } CODE B: public class DinnerRepository { private NerdDinnerEntities _NerdDinnerEntity = new NerdDinnerEntities(); // Query Method public IQueryable<Dinner> FindAllDinners() { return _NerdDinnerEntity.Dinners; } // Query Method public IQueryable<Dinner> FindUpcomingDinners() { return from dinner in _NerdDinnerEntity.Dinners where dinner.EventDate > DateTime.Now orderby dinner.EventDate select dinner; } // Query Method public Dinner GetDinner(int id) { return _NerdDinnerEntity.Dinners.FirstOrDefault(d => d.DinnerID == id); } // Insert Method public void Add(Dinner dinner) { _NerdDinnerEntity.Dinners.AddObject(dinner); } // Delete Method public void Delete(Dinner dinner) { foreach (var rsvp in dinner.RSVPs) { _NerdDinnerEntity.RSVPs.DeleteObject(rsvp); } _NerdDinnerEntity.Dinners.DeleteObject(dinner); } // Persistence Method public void Save() { _NerdDinnerEntity.SaveChanges(); } } CODE C: // ************************************** // GET: /Dinners/Create/ // ************************************** public ActionResult Create() { Dinner dinner = new Dinner() { EventDate = DateTime.Now.AddDays(7) }; return View(dinner); } // ************************************** // POST: /Dinners/Create/ // ************************************** [HttpPost] public ActionResult Create(Dinner dinner) { if (ModelState.IsValid) { dinner.HostedBy = "The Code Dude"; _dinnerRepository.Add(dinner); _dinnerRepository.Save(); return RedirectToAction("Details", new { id = dinner.DinnerID }); } else { return View(dinner); } } CODE D: // ************************************** // GET: /Dinners/Edit/{id} // ************************************** public ActionResult Edit(int id) { Dinner dinner = _dinnerRepository.GetDinner(id); return View(dinner); } // ************************************** // POST: /Dinners/Edit/{id} // ************************************** [HttpPost] public ActionResult Edit(int id, FormCollection formValues) { Dinner dinner = _dinnerRepository.GetDinner(id); if (TryUpdateModel(dinner)){ _dinnerRepository.Save(); return RedirectToAction("Details", new { id=dinner.DinnerID }); } return View(dinner); } I have sent Wrox and one of the authors a request for help but have not heard back from anyone. Readers of the book cannot even continue to finish the rest of chapter 1 because of these errors. Even if I download the latest build from Codeplex, it still has the same errors. Can someone please help me and tell me what needs to be fixed? Thanks - Ed.

    Read the article

  • Why doesn't jquery .load() load a text file from an external website?

    - by Edward Tanguay
    In the example below, when I click the button, it says "Load was performed" but no text is shown. I have a clientaccesspolicy.xml in the root directory and am able to asynchronously load the same file from silverlight. So I would think I should be able to access from AJAX as well. What do I have to change so that the text of the file http://www.tanguay.info/knowsite/data.txt is properly displayed in the #content element? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("jquery", "1.3.2"); google.setOnLoadCallback(function() { $('#loadButton').click(loadDataFromExernalWebsite); }); function loadDataFromExernalWebsite() { $('#content').load('http://www.tanguay.info/knowsite/data.txt', function() { alert('Load was performed.'); }); } </script> </head> <body> <p>Click the button to load content:</p> <p id="content"></p> <input id="loadButton" type="button" value="load content"/> </body> </html>

    Read the article

  • How have you successfully implemented MessageBox.Show() functionality in MVVM?

    - by Edward Tanguay
    I've got a WPF application which calls MessageBox.Show() way back in the ViewModel (to check if the user really wants to delete). This actually works, but goes against the grain of MVVM since the ViewModel should not explicitly determine what happens on the View. So now I am thinking how can I best implement the MessageBox.Show() functionality in my MVVM application, options: I could have a message with the text "Are you sure...?" along with two buttons Yes and No all in a Border in my XAML, and create a trigger on the template so that it is collapsed/visible based on a ViewModelProperty called AreYourSureDialogueBoxIsVisible, and then when I need this dialogue box, assign AreYourSureDialogueBoxIsVisible to "true", and also handle the two buttons via DelegateCommand back in my ViewModel. I could also somehow try to handle this with triggers in XAML so that the Delete button actually just makes some Border element appear with the message and buttons in it, and the Yes button did the actually deleting. Both solutions seem to be too complex for what used to be a couple lines of code with MessageBox.Show(). In what ways have you successfully implemented Dialogue Boxes in your MVVM applications?

    Read the article

  • How to get a TextBlock to wrap text inside a DockPanel area?

    - by Edward Tanguay
    What do I have to do to get the inner TextBlock below to wrap its text without defining an absolute width? I've tried Width=Auto, Stretch, TextWrapping, putting it in a StackPanel, nothing seems to work. XAML: <UserControl x:Class="Test5.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:tk="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" Width="800" Height="600"> <tk:DockPanel LastChildFill="True"> <StackPanel tk:DockPanel.Dock="Top" Width="Auto" Height="50" Background="#eee"> <TextBlock Text="{Binding TopContent}"/> </StackPanel> <StackPanel tk:DockPanel.Dock="Bottom" Background="#bbb" Width="Auto" Height="50"> <TextBlock Text="bottom area"/> </StackPanel> <StackPanel tk:DockPanel.Dock="Right" Background="#ccc" Width="200" Height="Auto"> <TextBlock Text="info panel"/> </StackPanel> <StackPanel tk:DockPanel.Dock="Left" Background="#ddd" Width="Auto" Height="Auto"> <ScrollViewer HorizontalScrollBarVisibility="Auto" Padding="10" BorderThickness="0" Width="Auto" VerticalScrollBarVisibility="Auto"> <tk:DockPanel HorizontalAlignment="Left" Width="Auto" > <StackPanel tk:DockPanel.Dock="Top" HorizontalAlignment="Left"> <Button Content="Add More" Click="Button_Click"/> </StackPanel> <TextBlock tk:DockPanel.Dock="Top" Text="{Binding MainContent}" Width="Auto" TextWrapping="Wrap" /> </tk:DockPanel> </ScrollViewer> </StackPanel> </tk:DockPanel> </UserControl>

    Read the article

  • What is the best way to bookmark positions in code in Visual Studio 2008/2010?

    - by Edward Tanguay
    I find myself going to about five or six main places in my code 80% of the time and would like a way to go to them fast even if all files are closed. I would like to be able to open up a solution in visual studio and with no file open, see a list of self-labeled bookmarks like this: LoadNext Settings page refresh app.config connections app settings stringhelpers top stringhelpers bottom I click one of these and it opens that file and jumps to that position. How can I best make bookmarks like this in Visual Studio 2008/2010?

    Read the article

  • Looking for a simple interface for users to enter data for Silverlight application

    - by Edward Tanguay
    I have made a Silverlight application which can read data from various URLs. So users of the application who control a website can: FTP text and XML files onto their website put a clientaccesspolicy.xml in their root directory enter their URL in the silverlight application at which point the silverlight application then begins reading data from their site. I would like to extend this to less technical users who do not control a website, aren't adept with FTP, etc. What is the best service on the web that: allows users to publish different kinds of data, e.g. put out text files on web allows Silverlight client access (has clientaccesspolicy.xml set up) Some ideas are: free blog services (although then they are limited to a RSS feed, or the silverlight app would have to do some screen scraping) Google Docs? free cloud services? What free services allow easy publishing of any kind of data on the web and allow Silverlight client access?

    Read the article

  • What is the best way to set up a PHP development environment on a Mac?

    - by Edward Tanguay
    When I do PHP, I use XAMPP to set up a development environment on Windows, then upload to Linux servers, works very well. I'm now passing on a PHP project to a person who has a Mac so he needs a local PHP dev environment. I noticed XAMPP has a version for Mac which I will recommend. But knowing that Mac is always a bit different, has anyone used any other easy PHP environment setup tool for the Mac, or I could even imagine that Mac solves this issue more elegantly by e.g. having a web server ready to go upon first boot etc. What is the best way to set up a PHP development environment on a Mac?

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >