none
What's All This Garbage When You Edit Your Question? RRS feed

  • Question

  • <form id="aspnetForm" action="edit" enctype="application/x-www-form-urlencoded" method="post">
    <input id="__VIEWSTATE" name="__VIEWSTATE" type="hidden" value="/wEPDwULLTEzNzk0MzkwMDlkZEMpty7R2lukRYyoGDAFiw9m2frw" />
    </form>
     
    <form action="/Forums/en-US/wpf/thread/d2d7bb5a-6ae5-412c-95a0-5d51f63a5d69/b43dfc3c-8469-4479-8817-0ffe4415b240/edit" enctype="application/x-www-form-urlencoded" method="post">

    Edit Message

    <textarea cols="100" rows="20" name="body"><p>Thanks for your response.</p> <p>My biggest problem is typed datasets and using them to validate anything they seem never to instansiate,&nbsp;the bold line below always returns null I cannot move forward without solving this. All examples I can find seem to use data created within the programs and not from databases with typed datasets. Please can you help me overcome this hurdle?</p> <div style="color:Black; background-color:White"> <pre> <span style="color:Blue">public</span> <span style="color:Blue">class</span> ICValidationRule : ValidationRule { <span style="color:Blue">public</span> <span style="color:Blue">override</span> ValidationResult Validate(<span style="color:Blue">object</span> value, System.Globalization.CultureInfo cultureInfo) { <strong> AlpsDataSet.InsuranceCompaniesRow ic = (value <span style="color:Blue">as</span> BindingGroup).Items[0] <span style="color:Blue">as</span> AlpsDataSet.InsuranceCompaniesRow;</strong> <span style="color:Blue">if</span> (ic != <span style="color:Blue">null</span>) { <span style="color:Blue">if</span> (ic.IsBuyer == <span style="color:Blue">false</span>) { <span style="color:Blue">return</span> <span style="color:Blue">new</span> ValidationResult(<span style="color:Blue">false</span>, <span style="color:#A31515">&quot;The Buyer Cannot be Empty&quot;</span>); } <span style="color:Blue">else</span> { <span style="color:Blue">return</span> ValidationResult.ValidResult; } } <span style="color:Blue">return</span> <span style="color:Blue">new</span> ValidationResult(<span style="color:Blue">false</span>, <span style="color:#A31515">&quot;Reinsured must have Advised Date&quot;</span>); } } </pre> </div> <div style="color:Black; background-color:White"> <pre> <span style="color:Blue">private</span> <span style="color:Blue">void</span> SetDefaultValues(<span style="color:Blue">object</span> sender, InitializingNewItemEventArgs e) { &lt;strong&gt; AlpsDataSet.InsuranceCompaniesRow mydatarow = e.NewItem <span style="color:Blue">as</span> AlpsDataSet.InsuranceCompaniesRow;&lt;/strong&gt; <span style="color:Blue">if</span> (mydatarow != <span style="color:Blue">null</span>) { mydatarow.IsBuyer = <span style="color:Blue">true</span>; <span style="color:Green">//checkbox</span> mydatarow.CompanyName = <span style="color:#A31515">&quot;My Company Name&quot;</span>; } } </pre> </div> <hr> John F Lundy</textarea>
    <label for="hasCode">Resource.HasCodeLabel</label><input checked="checked" name="hasCode" type="checkbox" value="true" /> <label for="reason">Reason</label><input name="reason" type="text" />
    <input title="Submit" type="submit" value="Submit" />
    </form>
    <script type="text/javascript"></script> <script type="text/javascript"></script> <script type="text/javascript"></script> <noscript></noscript> <noscript></noscript>
    John F Lundy
    Monday, February 28, 2011 7:33 AM

Answers

All replies

  • Must be a crap editor. Does this reflect on anyone?
    John F Lundy
    • Marked as answer by John F Lundy Monday, February 28, 2011 10:34 AM
    Monday, February 28, 2011 10:34 AM
  • Hi John,

    Sorry for the inconvenience.

    To edit your post, you can close all of your brower pages and re-open your brower, then click the "Edit' button. In this way, you could use the text editer to edit your post.

    Best Regards,


    Andrew Wu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, March 1, 2011 11:14 AM
    Moderator