|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
RequiredFieldValidator QuestionI'm extremly new to building web-applications, C#, and the whole Microsoft Visual Studio 2003 .NET IDE, so please bare with me. What I have: I have a web-application that communicates to an SQL Server. My aspx file is on a Windows 2000 Server running IIS. The base of the program is working just ducky. My problem: I'm trying to set the "ControlToValidate" property of a "RequiredFieldValidator" at run time and get an exception when my code executes. The error is "Unable to find control id 'System.Web.UI.WebControls.ListBox' referenced by the 'ControlToValidate' property of 'rfv_Parts'." CODE: : private void cmd_Submit_Click(object sender, System.EventArgs e){rfv_Parts.ControlToValidate = lstbox_Parts.ToString(); : }//END OF "cmd_Submit_Click" METHOD : Can someone tell me why this isn't working?Thanks, Randel Bjorkquist I'd try:
rfv_Parts.ControlToValidate = lstbox_Parts.ID; hth /Matthias Randel Bjorkquist wrote: Show quoteHide quote > Hi all, > > I'm extremly new to building web-applications, C#, and the whole Microsoft > Visual Studio 2003 .NET IDE, so please bare with me. > > What I have: > I have a web-application that communicates to an SQL Server. My aspx file > is on a Windows 2000 Server running IIS. The base of the program is working > just ducky. > > My problem: > I'm trying to set the "ControlToValidate" property of a > "RequiredFieldValidator" at run time and get an exception when my code > executes. The error is "Unable to find control id > 'System.Web.UI.WebControls.ListBox' referenced by the 'ControlToValidate' > property of 'rfv_Parts'." > > CODE: > : > private void cmd_Submit_Click(object sender, System.EventArgs e){ > rfv_Parts.ControlToValidate = lstbox_Parts.ToString(); > : > }//END OF "cmd_Submit_Click" METHOD > : > > Can someone tell me why this isn't working? > > Thanks, > > Randel Bjorkquist > > Hi Matthias,
I think I'm going about my thought wrong. Long story short, I'm trying to validate if there are more then one item in a ListBox. I tried using a RequiredFieldValidator, but that doesn't work. So I thought I could assign it the control I wanted to in the OnClick event of a Button and work it that way and that was why I'm was trying to programmably set the "ControlToValidate" property. Like I said, I'm really after being able to figure out how to determine if there are at least one entery into a ListBox when I submit my Web Form. Does that make sense? I'm still stuck. I've tried a CustomeValidator and a RangeValidator, but I've had no luck with either. If you have any more sugguestions, please don't hessitate to do so, okay? Thank you, Randel Bjorkquist Show quoteHide quote "Matthias S." <postamt@_remove_emvoid_remove_.de> wrote in message news:OPzXB4HNFHA.904@tk2msftngp13.phx.gbl... > I'd try: > > rfv_Parts.ControlToValidate = lstbox_Parts.ID; > > hth > > /Matthias > > Randel Bjorkquist wrote: >> Hi all, >> >> I'm extremly new to building web-applications, C#, and the whole >> Microsoft Visual Studio 2003 .NET IDE, so please bare with me. >> >> What I have: >> I have a web-application that communicates to an SQL Server. My aspx >> file is on a Windows 2000 Server running IIS. The base of the program is >> working just ducky. >> >> My problem: >> I'm trying to set the "ControlToValidate" property of a >> "RequiredFieldValidator" at run time and get an exception when my code >> executes. The error is "Unable to find control id >> 'System.Web.UI.WebControls.ListBox' referenced by the 'ControlToValidate' >> property of 'rfv_Parts'." >> >> CODE: >> : >> private void cmd_Submit_Click(object sender, System.EventArgs e){ >> rfv_Parts.ControlToValidate = lstbox_Parts.ToString(); >> : >> }//END OF "cmd_Submit_Click" METHOD >> : >> >> Can someone tell me why this isn't working? >> >> Thanks, >> >> Randel Bjorkquist
Checkbox in a datagrid always returns false
hosting app from pc Highlight the datalist row Chart position adding a new row to the repeater control Div tag to display/ hide a control ....please help RadioBNuttonList Problem query database, create control, display on page Trouble Filling DropDownList in Datagrid Compatibility problem of IEWebConrols |
|||||||||||||||||||||||