English 中文(简体)
页: 1 SetFocus on Error
原标题:asp.net usercontrol SetFocusOnError

我有一个页数,同一用户数页。 用户控制局拥有一个文本箱,拥有一个需要现场验证器。 有效器具的运转似乎并不可行,更进一步的是,当有效器显示错误信息时,星号仍向该代码开火。

这里,就用户控制和纽扣而言,星号的页面就是如此。

ucTB:ucTextBox ID="ucTextR" runat="server" ValidationGroup="txtRequired" Required="_true" 

asp:Button ID="btnSave" runat="server" Text="Click" ValidationGroup="txtRequired" 

和用户控制有效器

asp:RequiredFieldValidator ID="rfTextBox" runat="server" ControlToValidate="txtTextBox"
SetFocusOnError="true" ErrorMessage="Required Field"  EnableClientScript="false"  

用户控制已经通过电线将有效器从氧化物页上 gr,并在用户控制中加以使用。

 Public Property ValidationGroup() As String  
    Get  
        Return CType(ViewState("ValidationGroup"), String)  
    End Get  
    Set(ByVal Value As String)  
        ViewState("ValidationGroup") = Value  
    End Set  
End Property

Protected Sub AssignValidation()
    For Each control As Control In Me.Controls
        Dim [property] As PropertyInfo = control.[GetType]().GetProperty("ValidationGroup")
        If [property] Is Nothing Then
            Continue For
        End If
        [property].SetValue(control, ValidationGroup, Nothing)
    Next
End Sub

页: 1

无论如何,希望这是你需要向我指明正确方向的动因。

期望做的是,如果用户控制文本箱中没有任何东西,则要求外地有效者把重点放在用户控制上,而且对于 as子上没有火灾,则需要这样做。

thanks shannon

问题回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签