.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

where's the container in GetClientValidationRules?

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :ASP.Net
I'm creating my own ModelValidator inheritor. I'm essentially performing a "Required" check on properties based upon a property of the container. This worked out beautifully in the override of Validate(object container). However, GetClientValidationRules gives me no such "container" parameter/feature. How can I determine the container from inside the GetClientValidationRules override? The callstack shows that GetClientValidationRules is called as part of my call: Html.ValidationMessageFor(f=>f.Field). I need "f.IsRequired" to determine whether or not to send the client-side rule. Or can the rule be disabled on the client side with some other parameter for ValidationMessageFor?

View Complete Post

More Related Resource Links

Linq to Sql CompiledQuery container

Ok now let's go. Here is just a little trick but with some interesting patterns that could be useful in some other contexts not connected to Linq to Sql.

When using Linq expressions, like with Linq to Sql, translating the expression into something else (sql for example) is taking time and resources. Sometimes it's negligible, sometimes not...

Tab container rendered with visibility:hidden - This was reported over three years ago.



Here is (more) code that demonstrates the issue.  If the control in the host page is removed the tab control renders correctly.  Otherwise it is rendered with the visibility attrubute set to hidden as reported in the above link.  Is this broken or am I doing something wrong?



<%@ Page Language="C#" AutoEventWireup="true" CodeFile="S2.aspx.cs" Inherits="S2" %>
<%@ Register Src="~/SelectorPatternControl.ascx" TagName="TestControl" TagPrefix="sam" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <form id="form1" runat="server">
        <cc1:ToolkitScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true"></cc1:ToolkitScriptManager>

Re-positioning an HTML container with javascript onresize with a Master page.


I have an HTML <div> container that I float to the right of a gridview.  When the browser window is maximized, it looks fine.  When minimized, the gridview positions below the floating container and most of the data is pushed off the bottom of the browser - you have to scroll down to see it.

If I position the floating container above the gridview it looks fine in a minimized window, but looks real bad when maximized.

What I want to do is use a javascript: onresize event to re-position the floating container up or down depending on the window.inner.width AND do it with a Master/Content page structure AND do it for only the one page where needed.

I can capture the onresize event and display the window dimensions but haven't figured-out how to do it with a Content page that still uses the Master page.  I think I'm having a very "thick" week...

- Tinker


table inside tab container goes under the tab



my tab control going crazy

i have this code

and the intable button is under the tab and not inside. why? 


<asp1:TabContainer ID="Tabs"

export rsa key container


1) I want to create a rsa key in c# and export the container. I am having difficulty. I create container like this:

CspParameters cspParams = new CspParameters();            cspParams.KeyContainerName = "XML_ENC_RSA_KEY";CspParameters cspParams = new CspParameters();
cspParams.KeyContainerName = "XML_ENC_RSA_KEY";

The msdn example says I can export the container with this syntax:
aspnet_regiis -pa "XML_ENC_RSA_KEY" "NT AUTHORITY\NETWORK SERVICE". This does not work on my XP Host PC. I belive this is applicable for Windows 2003 Server.
So what is the correct syntax for exporting rsa key container from XP host?

2) To get aspnet_regiis.exe path I did something like this:

string winPath = Environment.GetEnvironmentVariable("windir");       
string fullPath = winPath + @"\Microsoft.NET\Framework\v2.0.50727" + @"\aspnet_regiis.exe";

But this path may be different for each host, based on the .NET verison installation.
Is there a way to get the aspnet_regiis.exe path from registry or a environment varaible?

3) Once I get the path to aspnet_regiis.exe I want to invokve it from c# like this.
Is this code correct?

ProcessStartInfo startIn

Deleting a key container. Detecting if it exists.

I have a need to detect if a key container exists. I have looked at http://msdn.microsoft.com/en-us/library/system.security.permissions.keycontainerpermission(VS.80).aspxbut I have two problems. One, the 'Deny' method appears to be obsolete. When I copy the code from this demo I get a warning that Deny is obsolete and will be removed. Two, if I follow the instructions to delete the key from the container it seems to work but if I subsequently try to get the key from the container I get another key and there is no indication that any key had been removed. Any ideas on thus manipulating key containers? Thank you. Kevin

cannot set name attribute value when using a container control

Hi,I created a usercontrol with a Grid. <UserControl x:Class="TestUserControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="300" Height="300"> <Grid Name="MainGrid" Background="Red" > </Grid> </UserControl> Next I created another Project and referenced the dll where this usercontrol is in. <UserControl x:Class="TestContainer" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:nds="http://schemas.test.eu/BaseElements" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="300" Height="300"> <Grid> <nds:TestUserControl> <Button Name="Btn1"></Button> </nds:TestUserControl> </Grid> </UserControl> With the schema i can load a instance of this usercontrol onto the new usercontrolNext I load a button onto thisWhen I now set the name property, the error "Warning 1 Cannot set Name attribute value 'Btn1' on element 'Button'. 'Button' is under the scope of element 'TestUserControl', which already had a name registered when it was defined in another scope. Line 7 Position 21. ......

Access the SQL Command Query Value Property from the OLEDB Container within a Script Task

Hello, I'd like to Access the SQL Command Query Value Property from the OLEDB Container within a Script Task so I can audit the queries which are executing. What is the syntax for this or does anyone have a sample on how to do this? Thank you

Change active tab in Ajax tab container using javascript

I have been using the ajax tab control. I need to change the active tab index of the tab container through javascript. Can please anyone tell me how can i do it Cheers Sohail Sayed

Tab Container, Tab panels with User Controls - bug?

Hello all, I have a aspx page with a tab container, and 5 tabs on it - 4 of which hold user controls on them. I have a strange issue that presents sometimes, and I am not sure just what is causing it. Here is the scenario : there is one user control on each tab. On each of those user controls, there are a number of radio buttons in Update Panels. If a user selects one of the tabs, then selects another tab and clicks on one of the radio buttons on that tab causing a postback, when the page refreshes, the content of the previous tab becomes visible at the top of the current tab, pushing the original content down below it - as if the content of the previous tab has been appended to the top of the current tab's content. Has anyone out there experienced anything like this? What I did to "fix" the issue was simply to go into the aspx code for the tab container, and change the order of the tab panels in the code, something like this :  <cc1:TabContainer ID="tabContainer" runat="server"> <cc1:TabPanel ID="tabFirstTab" runat="server" HeaderText="My first tab" > <ContentTemplate> <uc1:usercontrol1 ID="UC1" runat="server" /> </ContentTemplate> </cc1:TabPanel>

ForEach Loop Container Configuration Question

So here is my question/situation. I have a table that contains a list of all of our servers/instances for my organization. I have a script that I'd like to execute against all of the servers in that list and I was thinking that I should be able to use this container to pull the name/instance from the table, execute the script, store the results in a local table. However, I'm not quite sure on how to attack this meaning not sure which configuration that I would need to use to get me going down the right direction. I've looked around and found alot of documentation on how to enumerate multiple files and folders, but nothing really for what I'm trying to do. Any help or direction would be greatly appreciated.Big Ern

SSIS 2005 - Foreach loop container - Stopping the loop after processing X number of file?

I need to stop the Foreach loop container from processing more files in the folder than desired. Scenario:  If I only want 1 files processed, i need to stop the loop after it finds 1 file.  No matter what the contraints or tests or variables I set, the loop processes all the files in the folder.  This is bad because I need the value of the 1st mapped variable and not the last one it finds. I have tried counting records and setting variables used in the contraints but to no avail  Nothing seems to stop the loop. Please advise

How to go to next iteration of ForEach Loop container on task failure

I'm using a ForEach Loop container to iterate through a set of files and import/validate the data.  Within each loop, the first thing that happens is that I fill a variable from a table and then use a script task to make sure that the rest of the package should be run for this particular file.  If it should continue, I set Dts.TaskResult = Dts.Results.Success, and if it shouldn't, I set it to Dts.Results.Failure.  My question is, how do I get it to exit the current iteration of the loop and continue to the next iteration?  The way it is now, the package just stops completely.  I set the FailPackageOnFailure property to False for the script task, but that doesn't make a difference.  I also tried pointing a failure precedence contstraint bacl to the loop container, but that's not allowed.  How can I make it just continue in the loop?   Thanks.

Using Foreach loop Container in SSIS 2005 package and scheduling the package using SQL job on 64-bit

I've an SSIS package 2005 which uses a for each loop container, this package runs fine when I run it on the local machine . My server is 64 bit SQL 2005 and I 've successfully deployed my package on the server both to the File system and SQL server. I've also set Run64bitruntime to false in my pacakge. Now I need schedule the package using SQL job. Since Microsoft Jet Provider 4.0 is not available for 64 bit, I had to write script to schedule the package. Here is my script. declare   @ssisstr varchar(8000) declare @returncode int set   @ssisstr = 'dtexec /sq Package1 /DE 123' EXEC   @returncode = xp_cmdshell @ssisstr select   @returncode I'm getting the following error when I execute the job. Could not load package "Package1" because of error 0xC0010014. Description: One or more error occurred. There should be more specific errors preceding this one that explains the details of the errors. This message is used as a return value from functions that encounter errors. I'm getting the same error if I run this from commandline. Any help would be really appreciated. Thanks in advance. PARC

Format datetime in <%#DataBinder.Eval(Container.DataItem, "DBDate")%>

I have a date in a database which i bring into a repeater using <%#DataBinder.Eval(Container.DataItem, "DBDate")%>.  Can I format the datetime which is write to remove the time bit from it.  At the moment it is written in this format:25/02/2007 00:00:00. I want it to be 25/02/2007 or even a more readable date such as February 25th 2007. Thanks Andrew

Foreach Loop Container.ForEachEnumerator.Properties[FileSpec] Exception -This occurs when an attempt

I run into the following 2 exceptions when I execute a package on SQL Server 2005 64 bit machine. The package fails when SQL Server version is 9.0.3310 which is a production box. I have tested it on 3 others development boxes with SQL version 9.0.1399, 9.0.3315 & 9.0.4053 and the package executes fine. I am unable to make a determination if this issue is related to SQL versions or a bug in the package design. I would like to understand the exception better before I request an SP3 & patches installed to upgrade it to version 9.0.4053 on the production box. I have scheduled jobs to run these packages and we are trying to locate Excel files on a drive using For Each Loop Enumerator. The packages are configured to use configuration files. Please note the destination directory does have the Excel files we are looking for. Source: Well_Test_Package Description: The package path referenced an object that cannot be found: "\Package\Daily Alloc Spread Sheet Foreach Loop Container.ForEachEnumerator.Properties[Directory]". This occurs when an attempt is made to resolve a package path to an object that cannot be found.  End Warning  Warning: 2010-08-31 00:41:13.66     Code: 0x80012017     Source: Well_Test_Package      Description: The package path referenced an object that ca

Want to page content based off of a character limit or height of container

First of all I would like to say hello. I have created a backend that allows me to update my site content. I am using fckeditor to pull the data from my table in the database. The problem I am having is this:  I need to create paging of content so that when the height restriction is met a next btn or numbering system displays to allow the user to click to the next page of content. Can anyone point me in the right direction or possible tell me how I can do this?
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