Hello,
Anyone know how to do the following in c# - using inline codeblocks?
<% If Request.Form("Name") = "Gary" Then %>
<asp:RequiredFieldValidator ID="GarysValidation" ErrorMessage="Gary, you
have chosen the wrong option<BR>" ControlToValidate="Name" Display="Dynamic"
runat="server"></asp:RequiredFieldValidator>
<% End If %>
Thanks for any help,
Regards,
Gary.There's many free online C#/VB.NET code converters you can use to do that.
Here's a few, in no particular order.
Check them out...and see which one you like best.
http://www.carlosag.net/Tools/CodeT...or/default.aspx
http://www.dotnettaxi.com/Tools/Converter.aspx
http://www.developerfusion.co.uk/ut...vbtocsharp.aspx
http://www.eggheadcafe.com/articles.../converter.aspx
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"Gary" <g@.nospam.com> wrote in message news:Ogo7KdUPHHA.140@.TK2MSFTNGP04.phx.gbl...arkred">
> Hello,
> Anyone know how to do the following in c# - using inline codeblocks?
> <% If Request.Form("Name") = "Gary" Then %>
> <asp:RequiredFieldValidator ID="GarysValidation" ErrorMessage="Gary, you h
ave chosen the wrong
> option<BR>" ControlToValidate="Name" Display="Dynamic"
> runat="server"></asp:RequiredFieldValidator>
> <% End If %>
> Thanks for any help,
> Regards,
> Gary.
(via Instant C#)
<%
if (Request.Form["Name"] == "Gary")
{
%>
<asp:RequiredFieldValidator ID="GarysValidation" ErrorMessage="Gary, you
have chosen the wrong option<BR>" ControlToValidate="Name" Display="Dynamic"
runat="server"></asp:RequiredFieldValidator>
<%
}
%>
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
Instant Python: C#/VB to Python converter
"Gary" wrote:
> Hello,
> Anyone know how to do the following in c# - using inline codeblocks?
> <% If Request.Form("Name") = "Gary" Then %>
> <asp:RequiredFieldValidator ID="GarysValidation" ErrorMessage="Gary, you
> have chosen the wrong option<BR>" ControlToValidate="Name" Display="Dynami
c"
> runat="server"></asp:RequiredFieldValidator>
> <% End If %>
> Thanks for any help,
> Regards,
> Gary.
>
The on-line converters won't convert in-line asp.net code Juan. (see my
other reply for the conversion).
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
Instant Python: C#/VB to Python converter
"Juan T. Llibre" wrote:
> There's many free online C#/VB.NET code converters you can use to do that.
> Here's a few, in no particular order.
> Check them out...and see which one you like best.
> http://www.carlosag.net/Tools/CodeT...or/default.aspx
> http://www.dotnettaxi.com/Tools/Converter.aspx
> http://www.developerfusion.co.uk/ut...vbtocsharp.aspx
> http://www.eggheadcafe.com/articles.../converter.aspx
>
> Juan T. Llibre, asp.net MVP
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> ===================================
> "Gary" <g@.nospam.com> wrote in message news:Ogo7KdUPHHA.140@.TK2MSFTNGP04.p
hx.gbl...
>
>
re:
> The on-line converters won't convert in-line asp.net code Juan.
Maybe that should be a tip not to use ASP syntax in ASP.NET.
Would changing the control's visibility depending on the selected option be
better ?
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"David Anton" <DavidAnton@.discussions.microsoft.com> wrote in message
news:166F99D6-5D9D-4CA2-BBBD-4971B64B373C@.microsoft.com...
> The on-line converters won't convert in-line asp.net code Juan. (see my
> other reply for the conversion).
> --
> David Anton
> www.tangiblesoftwaresolutions.com
> Instant C#: VB to C# converter
> Instant VB: C# to VB converter
> Instant C++: C#/VB to C++ converter
> Instant Python: C#/VB to Python converter
> "Juan T. Llibre" wrote:
>
"Juan T. Llibre" <nomailreplies@.nowhere.com> wrote in message
news:OU%23Oz5XPHHA.4260@.TK2MSFTNGP02.phx.gbl...
> Maybe that should be a tip not to use ASP syntax in ASP.NET.
Absolutely!
> Maybe that should be a tip not to use ASP syntax in ASP.NET.
> Would changing the control's visibility depending on the selected option
> be better ?
Could you elaborate? You spotted I am a classic ASP coder, finding the
transition to .NET a challenge.
I do have a code behind file in place, and I am slowly reading about Life
Cycle etc, but at this moment I am unsure how best to approach this
particular task.
G.
re:
> I am unsure how best to approach this particular task
Maybe adding some server code would help...
<script language = "VB" runat="server">
Sub Get_Input (Src As Object, Args As EventArgs)
Output.Text = "You entered '" & Name.Text & "'"
End Sub
</script>
<form Runat="Server">
<asp:TextBox id="Name" Runat="Server"/>
<asp:Button Text="Submit" OnClick="Get_Input" Runat="Server"/>
<asp:RequiredFieldValidator Runat="Server"
ID="GarysValidation"
ControlToValidate="Name"
ErrorMessage="Gary, you need to enter a value."
Display="Dynamic"
SetFocusOnError="True"/>
<asp:Label id="Output" Runat="Server"/>
</form>
I'm assuming that what you are aiming for is not having an empty textbox or,
if there is one, that the user can be informed without disruption.
Is that what you are aiming for ?
The above code will display the message "Gary, you need to enter a value."
if the textbox is empty, or will display whatever the user wrote into the Na
me textbox.
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"Gary" <g@.nospam.com> wrote in message news:eiXaJ1ZPHHA.4244@.TK2MSFTNGP04.phx.gbl...darkred">
>
> Could you elaborate? You spotted I am a classic ASP coder, finding the tr
ansition to .NET a
> challenge.
> I do have a code behind file in place, and I am slowly reading about Life
Cycle etc, but at this
> moment I am unsure how best to approach this particular task.
> G.
On 1=E6=9C=8822=E6=97=A5, =E4=B8=8A=E5=8D=887=E6=99=8220=E5=88=86,
"Juan T.=
Llibre" <nomailrepl...@.nowhere.com> wrote:
> re:
>
> Maybe adding some server code would help...
> <script language =3D "VB" runat=3D"server">
> Sub Get_Input (Src As Object, Args As EventArgs)
> Output.Text =3D "You entered '" & Name.Text & "'"
> End Sub
> </script>
> <form Runat=3D"Server">
> <asp:TextBox id=3D"Name" Runat=3D"Server"/>
> <asp:Button Text=3D"Submit" OnClick=3D"Get_Input" Runat=3D"Server"/>
> <asp:RequiredFieldValidator Runat=3D"Server"
> ID=3D"GarysValidation"
> ControlToValidate=3D"Name"
> ErrorMessage=3D"Gary, you need to enter a value."
> Display=3D"Dynamic"
> SetFocusOnError=3D"True"/>
> <asp:Label id=3D"Output" Runat=3D"Server"/>
> </form>
> I'm assuming that what you are aiming for is not having an empty textbox =
or,
> if there is one, that the user can be informed without disruption.
> Is that what you are aiming for ?
> The above code will display the message "Gary, you need to enter a value."
> if the textbox is empty, or will display whatever the user wrote into the=
Name textbox.
> Juan T. Llibre, asp.net MVP
> asp.net faq :http://asp.net.do/faq/
> foros de asp.net, en espa=C3=B1ol :http://asp.net.do/foros/
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3Ddarkred">
> "Gary" <g...@.nospam.com> wrote in messagenews:eiXaJ1ZPHHA.4244@.TK2MSFTNGP=
04.phx.gbl...
on be better ?
>
transition to .NET a
>
fe Cycle etc, but at this
>
I would like to ask that, if i have a VB.net file, is there any free
tools for me to convert it into C#.net?
Thx a lot!!!
<yyshirman@.gmail.com> wrote in message
news:1170753596.902466.298390@.q2g2000cwa.googlegroups.com...
> I would like to ask that, if i have a VB.net file, is there any free
> tools for me to convert it into C#.net?
Loads of 'em - do a Google search...
0 comments:
Post a Comment