ASP.NET

123K

Solutions

35

Articles & Videos

28K

Contributors

The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications

Share tech news, updates, or what's on your mind.

Sign up to Post

Hi Guys,

I need help with visual basic syntax.
I"m trying to create dropdown list on my page with @html helper, so in C# which I'm familiar with it looks like this:
 @Html.DropDownList("ddlAdditional1", New SelectList(ViewBag.Listofitem, "", "id"), New { @CssClass="form-control", Width="180px"}  )

Open in new window


but in VB I think the syntax is different and I can't find what is the right one.

I will be appreciate if you can give me the server side code in vb as well.

thanks,
0
On Demand Webinar: Networking for the Cloud Era
LVL 9
On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Hello Experts,

We are getting intermittent timeouts on some of our sites on a windows 2008 r2 box with iis 7.5, this started recently.

The sites are down for a while and then run again (Its limited to a small subset of sites on the box) The are all DNN sites but not all DNN sites are effected

The sites can be browsed locally on the local ip but not external, some have ssls installed

Any advise on how to troubleshoot this

stu
0
Hi,
To the list of this

http://my-friend.co/Test_rec4/Default.aspx?userid=mc23

how to create click event to record/row, to further go to other URL?
0
Hello Experts,

I'm having trouble retrieving/displaying the City value from the database to the City drop down list based on the selected Customer's ID that I wish to Edit.

When I select a Customer to Edit it populates the data from the database properly except for the City drop down list. The City drop down list will show "Select a City" along with all Cities that are related to the State in the State drop down list.

If I select another state then it loads all cities for the selected state properly.

The problem is that it does not show the City value for the City drop down list like it should when I first load the page.

Edit View:
@model WebAppCascadeDropDown.ViewModels.CustomerFormVM

@{
    ViewData["Title"] = "Edit";
}

<h2>Edit</h2>

@using (Html.BeginForm("Edit", "Customer"))
{
    <div class="form-group">
        @Html.LabelFor(c => c.FirstName)
        @Html.TextBoxFor(c => c.FirstName, new { @class = "form-control" })
    </div>

    <div class="form-group">
        @Html.LabelFor(c => c.LastName)
        @Html.TextBoxFor(c => c.LastName, new { @class = "form-control" })
    </div>

    <div class="form-group">
        @Html.LabelFor(s => s.StateId)
        @Html.DropDownListFor(s => s.StateId, new SelectList(Model.States, "StateId", "StateAbbr"), "", new { @class = "form-control" })
        @Html.ValidationMessageFor(s => s.StateId)
    </div>

    <div class="form-group">
        @Html.Hidden("hCityId", (object)ViewBag.CityId)
        

Open in new window

0
Hello Experts!

I have a website that uses microsoft.aspnet.Identity for Logging in.  I have a companion windows program that I'd like to be able to create users and make adjustments to the settings of the website.  

Is it possible to Microsoft.aspnet.Identity to create users in a Windows Program or is that only for Web only?
Would anyone have example code?

thanks!
0
public HttpResponseMessage ER_GenerateWBLWorksheet2()
    {

        Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application();
        Microsoft.Office.Interop.Excel.Workbook xlWorkBook;
        Microsoft.Office.Interop.Excel.Worksheet xlWorkSheet;
        object misValue = System.Reflection.Missing.Value;

        xlWorkBook = xlApp.Workbooks.Add(misValue);
        xlWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);

        if (xlWorkSheet == null)
        {
            Console.WriteLine("Worksheet could not be created. Check that your office installation and project references are correct.");
        }

        xlWorkSheet.Cells[1, 1] = "Account Number";
        xlWorkSheet.Cells[1, 2] = "Amount";
        xlWorkSheet.Cells[1, 3] = "Code123";
        xlWorkSheet.Cells[1, 4] = "Date";
        xlWorkSheet.Cells[1, 5] = "Audit";
        xlWorkSheet.Cells[1, 6] = "ID";
        xlWorkSheet.Cells[1, 7] = "Customer Name";
        xlWorkSheet.Cells[1, 8] = "Payment Source";
        Microsoft.Office.Interop.Excel.Range range = xlWorkSheet.get_Range("A2", "A2");//add this drop down list to all rows of first column
        Microsoft.Office.Interop.Excel.DropDowns xlDropDowns;//code to add drop down list
        Microsoft.Office.Interop.Excel.DropDown xlDropDown;
        xlDropDowns = ((Microsoft.Office.Iterop.Excel.DropDowns)(xlWorkBook.ActiveSheet.DropDowns(Type.Missing)));
 …
0
I have a form in  razor view (see sample code below). In the form tag, i have specified controller action method, that will be called when form is posted. I want to validate user input, when user clicks on search button. and if there are any errors in user input, prevent the form posting and display errors.

I can create a javascript/jquery function to check for user input validation. how should i call the this function and how can i prevent the form submission, if there are any errors?


--default.cshtml
 <form id="defaultForm" method="post" action="controllerMethod">

<input type="submit" id="searchBtn" value="Search" />
......
</form>
 <script type="text/javascript">
</script>
1
On my asp.net mvc view page I have textbox like this.

The EventTime field is a DateTime datatype in the database.
I'm using the Entity Framework Database First approach.

On the web browser i'm displaying it like this:  09:00 AM

@Html.TextBoxFor(model => model.EventTime, "{0:hh:mm tt}", new { @class = "form-control", id = "EventTime" })
@Html.ValidationMessageFor(model => model.EventTime)

But the validation is saying "The field EventTime must be a date."


Any ideas of how to fix this?
0
Hi Guys,
I have aspx page that have textbox controller and listbox controller in my page:
<asp:TextBox ID="txtObject" onfocus="this.select();" runat="server" AutoPostBack="True" CssClass="form-control"></asp:TextBox>
<asp:ListBox Style="border: none; min-height: 350px;" Width="100%" ID="lstTracked" runat="server"></asp:ListBox>

Open in new window


Now, when I type some text on the textbox and enter it is inserting the text to the lstbox and so on, but in some point after I enter 3 4 and sometimes 10 entries I'm getting error:

Here is the error:
Source:      System.Web
Description:      Invalid postback or callback argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
Source:      Void ValidateEvent(System.String, System.String)
Data:      at System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) at System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) at System.Web.UI.WebControls.ListBox.LoadPostData(String postDataKey, NameValueCollection postCollection) at System.Web.UI.WebControls.ListBox.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, …
0
Hi Experts,

Why my code not working?

I have multiple checkboxes and are categoriesed into two parts.

1. Select All (has approx 15-20 checkboxes under it)
2. Release

Scenrio :
Expected : When I click on 'select all' checkbox it should select all the other but except 'release' checkbox.

Not Expected : But in my case the following Code selects all the checkboxes
<script type="text/javascript">
		function checkUncheckAll(theElement) {
			var theForm = theElement.form, z = 0;
			for (z = 0; z < theForm.length; z++) {
			    if (theForm[z].type == 'checkbox' && theForm[z].name != 'ckrelease') {
			        theForm[z].checked = theElement.checked;
			    }
			}
		}
	</script>

Open in new window


<asp:CheckBox ID="ckrelease" runat="server" Text="Release" AutoPostBack="true" TextAlign="Right" OnCheckedChanged="ckRelease_CheckedChanged" />
<input id="Checkbox1" onclick="checkUncheckAll(this);" type="checkbox" tabindex="32" />

Open in new window


Please help.

Regards,
D Patel
0
Independent Software Vendors: We Want Your Opinion
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Si,

I've added a quartz timer to my web app and let it run in Application_start (global.asax).

The idea is that the timer sends mails once a day.

Problem now is that application_start is not always active (application pool restarts, no activity).
The website is on a shared hosting platform (IIS). So my options are limited.

Does anyone have an idea how to keep the ASP.NET web app alive so the timer is Always running and the mails are being send?

Thanks!

Kind regards,
Gery
0
I need a query using which i can hide the details of Products not selected while shopping..for eg suppose we have 5 products option to buy and we choose only 2 out of 5, is there any sql-query or method(Repeaters,data list..etc) using which we can hide the item details not selected..using asp.net c#
0
Hello all,

I have an asp.net mvc project and I am trying to moq a datatable within a controller like so:

Controller:
public JsonResult LoadCustomerData(string viewName)
{
            var dataRequest = loadDataRequest(viewName);
            DataTable viewData = CustomerDataService.GetData(viewDataRequest);
}

private loadDataRequest(viewName)
{
//loads request here
}

This is a sample to scale down what I have but I tried in a test to do a setup on the CustomerDataService and return a fake datatable I created but when I call the controller the DataTable is = null still.

Thanks
0
I want to add categories but I have this error
Here Is the source code
Line 70:                                            <asp:DataList ID ="dd" runat="server">
Line 71:                                             <ItemTemplate>
Line 72:                                                 <li><a href="#Events.aspx?type=<%#Eval("EventTypeName") %>"><%#Eval("EventTypeName") %></a></li>
Line 73:                                                </ItemTemplate>  
Line 74:                                             </asp:DataList>    

Open in new window

Code behind
 
con.Open();
        SqlCommand cmd = con.CreateCommand();

        if (Request.QueryString["type"] == null)
        {
            cmd.CommandText = "SELECT * FROM EventDetail";
        }
        else
        {
            cmd.CommandText = "SELECT * FROM EventDetail WHERE EventType_ID= '" + Request.QueryString["type"].ToString() + "' ";
        }

        SqlDataAdapter da = new SqlDataAdapter(cmd);
        DataTable dt = new DataTable();
        da.Fill(dt);
        dd.DataSource = dt;
        dd.DataBind();
        con.Close();

Open in new window


I have 2 tables
1. Event Type ( EventType_ID, EventTypeName )
2. EventDetail (EventDetail_ID, EventType_ID, eventDetailName....)
0
I have a web service built with VS 2017 in an ASP.Net website. I need to call that service from a form within an ASP.Net Core website. Is there a way to do this. Ideally, I want a form in the ASP.Net core website that will call the web service when a button is clicked. So far I'm struggling to get something, and there does not seem to be much documentation yet. Thanks for any help.
0
How do you find out in programming ASP.NET pages what version of html is being used?
Is there a setting in Visual Studio?

What trigger my question was I read the following:

The width attribute of <td> is not supported in HTML5. Use CSS instead.
CSS syntax: <td style="width:100px">

https://www.w3schools.com/tags/att_td_width.asp
0
After clicking the type, it still shows all the items!
source code
   <asp:DataList ID ="dd" runat="server">
                                                <ItemTemplate>
                                                <li><a href="#Events.aspx?type=<%#Eval("EventTypeName") %>"><%#Eval("EventTypeName") %></a></li>
                                               </ItemTemplate>
                                            </asp:DataList>

code behind
 con.Open();
        SqlCommand cmd = con.CreateCommand();
        cmd.CommandType = CommandType.Text;

        if (Request.QueryString["type"] == null)
        {
            cmd.CommandText = "select * from EventDetail";
        }
        else
        {
            cmd.CommandText = "select * from EventDetail where EventTypeID= '"+ Request.QueryString["type"].ToString()  + "' ";
        }

        cmd.CommandText = "select * from EventType";
        cmd.ExecuteNonQuery();
        DataTable dt = new DataTable();
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        da.Fill(dt);
        dd.DataSource = dt;
        dd.DataBind();
        con.Close();

my two tables
1. EventDetail (EventDetail_ID, EventTypeID, eventDetailName, eventDate......)
2. EventType (EventType_ID, EventTypeName)
0
Hi how do i insert an image in a form that i send via email
ObjSendMail.HTMLBody ="Nombre:" +" " + Request.Form("fname") & Chr(10) & "<br>Email:" +" " + Request.Form("email") & Chr(10) & "<br>Consultorio:" +" " + Request.Form("consultorio") & Chr(10) & "<br>Comentarios:" +" " + Request.Form("message")

Open in new window


thats the text, i want to insert an image in the top of that

<img src="images/Oncdelbajiologo.png"

regards
0
I cannot seem to get FedEx Tracking API to work at all.

I reviewed the API and have been trying to get the examples to run.  However when I try todo this I get a lot of errors.  I am trying to build a simple Package Tracking page but the FedEx API is not documented in a way that I can use.

Any help would be great!  

When using the FedEx example code when i run the application i get this error.

An unhandled exception of type 'System.InvalidOperationException' occurred in System.Xml.dll

Additional information: Unable to generate a temporary class (result=1).

error CS0029: Cannot implicitly convert type 'TrackWebServiceClient.TrackServiceWebReference.NotificationEventType' to 'TrackWebServiceClient.TrackServiceWebReference.NotificationEventType[]'
0
PeopleSoft Has Never Been Easier
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

I am doing CSV upload on Asp.net and its taking more than 1 hour to upload, So I has set sessiontimeout as 2 hour, I have set time out in below places:
1) In web.config :<sessionState timeout="120"></sessionState>
2) In web.config: <httpRuntime maxRequestLength="1048576" executionTimeout="7200" />
3) In .aspx page :     <asp:ScriptManager ID="scrpt1" runat="server" AsyncPostBackTimeout="7200">
                            </asp:ScriptManager>
4) In IIS: Application Pool have sesstion timeout as 120min
5) In IIS: In Website Advance setting set session timeout as 120 min.

   Still my page get blank after 1 hour and If i try to refresh then it shows Session Timeout, However my CSV Upload continue to work on database and it completes all upload in database in 2hour but Page get expired. Please help asap.

   FYI I am using IIS 7 on Windows server 2008 machine.

Regards,
Sudhanshu
0
Hello Folks,

I've two websites in ASP.NET and staging environment was Window Server (WS) 2008 R2 (Standard).
The SSO (Single Sign-On) was working perfectly on this WS 2008 R2 (Standard).

But the customer wants to move on Windows Server 2012 R2 (Standard), but SSO using form-based authentication couldn't work.
I am having below error

Event code: 4005
Event message: Forms authentication failed for the request.

Did you experience about this problem before for WS 2012 R2 (Standard)?

Best Regards
0
Hi Experts,

 How can I display the group header, on the page header of each page. I have attached the screen shot. In the page2.png, My group header is  "Chalk - Clybourn" so my page header is "Chalk - Clybourn". In the second page page3.png my group header is "test - test "  how can I make the page header the same. Actually I want the school name and its address on every page. I already set the "Keepwithgroup" to "After" and "repeatOnNewPage=true". It did not help.

 Thanks in advance.

Page1.png
Page2.png
Page3.png
0
<DateTimeSent>2017-06-15T14:49:19-07:00</DateTimeSent>

I would like to convert like 06/15/17 with time (without sec). how can I do that in c#?
0
I have a javascript function:

 function textCounter(field, cntfield, maxlimit) {
        if (field.value.length > maxlimit) {
...
   

Open in new window


It takes the field name that I pass in. The field name is passed in by the "ClientId"
txtAnswer.Attributes.Add("onKeyUp", "textCounter(this," & txtLengthDisplay.ClientID & "," & Me.MaximumLength & ")")

Open in new window


Above is just one example of the attributes added to trigger this method that counts the characters as you type them into the txtAnswer field.

The only time this  works is if I have the txtLengthDisplay defined with ClientIDMode="Static" and there is only ONE field on a screen that uses this.

If I change it to any of the other 3 options, AutoID, Predictable, or Inherit, it does nothing even if only ONE field is on the screen using it.

But Static ruins it for when I am calling this control multiple times in my placeholder, and I want multiple text fields on the screen doing the countdown.

example of what I'm doing. but with multiple controls on the page.
Any suggestions?

thanks!
0
Hi I have created .Net datatables and inserted around 10,000 rows into that, What I am looking is inserting that datatable values
in to Oracle Table directly. I am doing this to improve speed because If i insert data row by row from CSV to Oracle table then It takes 3hours to insert. Please help for correct solutions.
0

ASP.NET

123K

Solutions

35

Articles & Videos

28K

Contributors

The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications