TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Valerie Meunier
NA
693
81.7k
3 errors when converting from vb.net
Apr 13 2021 1:31 PM
Hi
I have converted an application from vb.net to C# but with three errors.
Thanks for helping me.
Valerie
1) if (e.Row.RowState == 0 | e.Row.RowState == 1)
=> Operator '==' cannot by applied to operands of type 'System.Web.UI.WebControls.DataControlRowState' and 'int'
The error occurs right of the | sign (e.Row.RowState == 0 doesn't give an error).
2) How to convert this code from vb.net to C#: check whether the inputs are actually valid dates
if Not IsDate(e.Values("begdat")) Or Not IsDate(e.Values("enddat") then
I tried this: if ( ! e.Values["begdat"] is DateTime | ! e.Values["enddat"] is DateTime )
but then error: Operator '!' cannot by applied to operands of type 'System.DateeTime
3) var naamtxt = new TextBox();
foreach (var dvr in DetailsView1.Rows)
naamtxt = (TextBox)dvr.FindControl("naamtxt");
naamtxt.Focus();
Code in the aspx page:
<asp:TemplateField ><InsertItemTemplate>
<asp:TextBox id="naamtxt" runat="server" Text='<%# Bind("naam") %>' ></asp:TextBox>
</InsertItemTemplate></asp:TemplateField>
This gives the error: "object does not contain a definition for 'FindControl' ..."
Reply
Answers (
3
)
Formatted dates (client-side) using Jquery in ASP.NET Mvc .NET CORE
.Net Core Web API Development