ASP.NET

125K

Solutions

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

I have two text boxes where user can select dates, then click the submit button to populate a webgrid, this works, but when I click on the sort or the filter the dates in the texboxes are not passed back and reset to current date - how can I keep the dates so I can utilize the sort, filters.

here is the code i am using

VIEW
@model IGrid<rptEODTelco>


@{
    ViewData["Title"] = "EOD Telco Summary";

}

<head>
    <link href="~/css/mvc-grid/mvc-grid.css" rel="stylesheet">
</head>

<div class="col-md-12">
    <div class="form-group">
        <form action="/Reports/EODTelcoSummary" method="post">
            <label for="StartDate">Start Date:</label>
            <input type="date" name="StartDate" value="@ViewBag.StartDate" />
            <label for="EndDate">End Date:</label>
            <input type="date" name="EndDate" value="@ViewBag.EndDate" />
            <button type="submit">Submit</button>
        </form>
    </div>
</div>

<div class="col-md-12">
    <div class="panel panel-primary list-panel">
        <div class="panel-heading list-panel-heading">
            <table align="center" width="100%">
                <tr>
                    <td align="center" colspan="2"><span style="font-size:28px;">EOD Telco Summary</span></td>
                </tr>
            </table>

        </div>
    </div>
    <div class="class=" panel-body">
        @(new HtmlGrid<rptEODTelco>(Html, Model))
    </div>
</div>

<script src="~/js/mvc-grid/mvc-grid.js"></script>
<script>

Open in new window

0
I am sending a file with  HttpContext.Current.Response

I need to loop through, create a file, send it to the browser for download. Then create another file and send it to the browser for download.

On the second one I get an error:
Server Cannot Append Header After HTTP headers have been sent Exception

So I added this:
HttpContext.Current.Response.ClearHeaders()

and now get this error:
Server cannot clear headers after HTTP headers have been sent.

Any solutions for sending multiple files without intervention from the user? (someone said to put a button for each file, that is not an option, as we are sending a file for every 100 pages as an example and don't know how many files we might have and we could be spamming a ton of buttons to the screen and making them click them all and remember which one they clicked).

Someone else suggested zipping up the files, but due to most of our clients not being allowed to install on their machines and people all fretting over viruses in zip files, the boss does not see that as a solution.

What solutions do you recommend that you have used?

Thanks!
0
I use a datatable to do some sorting for a GridView

dtSort.DefaultView.Sort = e.SortExpression + (string)((e.SortDirection == SortDirection.Ascending) ? " ASC" : " DESC");

Then I save the dtSort in ViewState["DataTable2"].
And then use it with the GridView. And it get sorted. Sorting works great in the GridView.

But when I set this same sorted datatable (ViewState["DataTable2"]) as DetailsViews datasource it looks like the sortorder not comes here.
Then the PageID is not the same as the rowindex in the GridView. I got the rowindex from the DataTable and not from the GridView so it should work in both GridView and DetailsView objects?

What do I miss? Looks like it works different in GridView and DetailsView?
0
hi

i have a drop down list filled from server side as below:
(where SelectStatusCbo is the drop down and lStatusDS is the dataset)
 With SelectStatusCbo
                            .DataSource = lStatusDS.Tables(0)
                            .DataTextField = "Status_DescE" '"P_cle_stat"
                            .DataValueField = "internalCode" '"p_stat_int"
                            .DataBind()
                        End With
the dataset contains teh below column :
Process1, Status_DescE and internalCode
nowin javascript i need to do  the below:
 $("#" + SelectStatusCbo.id).on("change", function () {
//need to read the dataset and appropriate column of teh datase how to dow it?
}
well i need to read the dataset of the drop down in javascript goto the selected index and read each column value how to do it?
0
I encounters an error when running the ASP Core app. Actually, I have no idea which Microsoft.EntityFrameworkCore should I refer in my project ? I suppose my app is running 3.0.0-preview8-28405-07. Am I correct ?

Thx
0
Hi I am getting the following error is my ASP.net web app when I click a GridView button. I am using .net framework 4.6.1. What would cause this

Server Error in '/' Application.
Maximum request length exceeded.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Maximum request length exceeded.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[HttpException (0x80004005): Maximum request length exceeded.]
   System.Web.HttpRequest.GetEntireRawContent() +9935848
   System.Web.HttpRequest.FillInFormCollection() +415
   System.Web.HttpRequest.EnsureForm() +69
   System.Web.HttpRequest.get_Form() +13
   System.Web.HttpRequest.get_HasForm() +9932779
   System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +95
   System.Web.UI.Page.DeterminePostBackMode() +69
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +130

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3429.0
0
Hi. In ASP.net what VB.net code would I use to see if the site has been published. I have to run slightly different code to what I run in debug mode.
0
I can pass javascript with 1 arg to WebMethod  on my aspx webform but I am unable to pass javascript object to my codebehind WebMethod. What's can I do to pass a Object to my aspx.cs  WebMethod? Get get the 500 status error when I click the btn.


This work.....
//==============
My ajax1:
//===============
function Show1() {
   
    $.ajax({
        type: "POST",
        url: "MyPage.aspx/GetCurrentTime",
        data: '{name: "' + document.getElementById("txtUserName").value + '" }',
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: OnSuccess,
        failure: function (response) {
            alert(response.d);
        }
    });
}
function OnSuccess(response) {
    alert(response.d);
}




My Web Method:

      [WebMethod]
        public static string GetCurrentTime(string name)
        {
            return "Hello " + name + Environment.NewLine + "The Current Time is: "
                + DateTime.Now.ToString();
        }





This does not work....

//==============
My ajax2:
//===============
function Show2() {

    var val = { FirstName: "Mark", LastName: "Jones" };
    var iParam = { Info: val };

    var iUrl = "MyPage.aspx/Test";


    $.ajax({
        url: iUrl,
        data: JSON.stringify(iParam),
        contentType: "application/json; charset=utf-8",
        type: 'POST',
        dataType: 'html',      
       success: OnSuccess,
        failure: function…
0
Previously, the project is created with the following command :
dotnet tool install --global dotnet-ef --version 3.0.0-preview4.19216.3

If i want to update it to new version, do I need to uninstall it before rerun the above command with higher version ?

Thx
0
On a web page, in my solution, there is an extra "v", that I can't seem to find in the source code. It's an ASP.NET page (SharePoint visual web part). When I view the page in a browser and choose View source I see this:
<tr>
        <td class="style5">
            &nbsp;</td>
        <td bgcolor="#F5F5F5" class="style6">
            <span id="ctl00_m_g_b503369d_31fd_47d1_b2c7_a677130130bb_ctl00_DecisionADTLabel"></span>
        </td>
    </tr>
    v
    <tr>
        <td class="style5">
            &nbsp;</td>
        <td bgcolor="#F5F5F5" class="style6">
            <span id="ctl00_m_g_b503369d_31fd_47d1_b2c7_a677130130bb_ctl00_DecisionMGECreditLabel"></span>
        </td>
    </tr>

Open in new window

You can see the v between the two tr tags in the middle. But in my code behind, it is not there:
  <tr>
        <td class="style5">
            &nbsp;</td>
        <td bgcolor="#F5F5F5" class="style6">
            <asp:Label ID="DecisionADTLabel" runat="server"></asp:Label>
        </td>
    </tr>
    <tr>
        <td class="style5">
            &nbsp;</td>
        <td bgcolor="#F5F5F5" class="style6">
            <asp:Label ID="DecisionMGECreditLabel" runat="server"></asp:Label>
        </td>
    </tr>

Open in new window

It looks very strange with this extra "v" by itself. How can I remove it?
0
Hi

I have been asked to load an ASP.net using RDP

An example of the destination is

Vbg.ddns.net

How do I do this?
0
Hi. When I select an item in my ASP.net DropDownList I don't see the value in the variable P below
Also after the section the DropDownList text is  blank. What might cause this

    Protected Sub DropDownList1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DropDownList1.SelectedIndexChanged


        Dim P As String = Me.DropDownList1.Text

    End Sub
0
I find that my Javascript inside ASP.NET Core Razor page can't be called up. Any idea ?

Thx
_Layout.cshtml
Add.cshtml
Add.cshtml.cs
AddItemModel.cs
0
We have xamarin based mobile application and an API which is made in asp.net core hosted in windows azure.

Till last week we have been using an http url for calling the api in the mobile application. for example http://api.xxx.com
Everything was working right.

This week we changed to https://api.xxx.com.
Since then when we build the android app on the actual device we getting this error.

"System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error: TrustFailure (Authentication failed, see inner exception.) ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner android native xamarin"

Not sure what is causing this error but till now we did not find a solution
0
Error with resources when using ajaxtabcontainer.  I have other ajaxcontrols on the page (calendar) that have not had a problem, but after adding the tab container to the page I get an error as follows.

Error Rendering Control - Table2 An unhandled exception has occurred.
Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "AjaxControlToolkit.Properties.Resources.NET4.resources" was correctly embedded or linked into assembly "AjaxControlToolkit" at compile time, or that all the satellite assemblies required are loadable and fully signed.

Open in new window

Below is the code:
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
    </asp:ScriptManager> 
<asp:Table ID="Table2" runat="server" Height="70%" Width="100%">
                <asp:TableRow>
                <asp:TableCell ID="TableCell22" RowSpan="6" Width="20%" VerticalAlign="Top" HorizontalAlign="Center" 
                BorderStyle="Inset" BorderWidth="2" BorderColor="Gray" runat="server" Height="100%" CssClass="CellPadding">
<asp:Panel ID="Panel2" runat="server">
                    <ajaxToolkit:TabContainer ID="TabContainer1" runat="server" BackColor="Black" BorderStyle="None" 
                        Font-Names="Arial" Font-Size="10" ForeColor="#FFFFCC" AutoPostBack="True" TabStripPlacement="Bottom">
                        
                        <ajaxToolkit:TabPanel runat="server" ForeColor="#FFFFCC" Font-Size="10" 
          

Open in new window

0
Hi,

I have set up a very simple update panel page as I was getting a full postback each time on a new site I have set up in VWD, it refuses to update just the update panel, but if I copy over the page to the older site it works fine.

They have identical web configs and I'm not using a master page so no interference there.

Same on the live server, one work, one doesn't - any ideas?

Cheers
Karl
0
I have a horizontal form that I created in an ASP.NET MVC 5 project with Bootstrap 3 (I know this is an old version and may convert to version 4 later). The form-horizontal form is not fitting the full width of the screen even though I have a total of 12 columns in the class. I'm sure it's a simple fix, I just haven't been able to figure it out. I am not using any custom CSS on this page. Here is part of the code. It just has one of the divs. I can provide full code if needed.

<h2>Create Customer</h2>

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()

    <div class="form-horizontal">
        <h4>Customer</h4>
        <hr />
        @Html.ValidationSummary(true, "", new { @class = "text-danger" })


        <div class="form-group">
            @Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })
            </div>
        </div>

Open in new window

0
I have an application running in ASP.NET/C#/IIS/SQL Server.

The application is not rendering correctly on any browser other than Internet Explorer.

I have added a document with the details on display and some setting changes I had to make for PCI Scan Vulnerabilities.

Please advise on what the issue may be.

Thanks,

Bruce Merevick
GCC-image-issue.docx
0
Hi. I want to generate a pdf document on my ASP.net website. Is there a website with an api that I might use to create for instance a purchase order or invoice using VB.net
0
Hi,

I wanted to allow my customers, when purchasing standalone software, to view certain data, such as sales and expense reports, from a tablet or smartphone.
What is the best way to do this, create an asp.net app and sync the data with a cloud database, but what is the best service to do it Azure or otherwise.
Or configure Windows server so that you can remotely access the same asp.net app locally?
best regards
0
I am using VS2015 and VS2019. I often need to debug, step through, and compare code side by side in different branches.

So I need to have my projects have different ports.

I used to be able to do that in VS2012. How can it be done in VS2019.

I am using a web site, not a web application.

Thanks!
0
Try to create a razor pages in another new created folder "Pages". However, it seems that ASP.NET Core can't recognize it. Any idea ?

I'm using ASP.NET Core.

Thx
Eorro.png
Physical-Folder.png
0
Try to run dotnet ef migration but fails. Any idea ?

C:\Projects\slivrr>dotnet add package Microsoft.EntityFrameworkCore --version 3.0.0-preview.18572.1
  Writing C:\Users\tonyleung.abc\AppData\Local\Temp\tmp6309.tmp
info : Adding PackageReference for package 'Microsoft.EntityFrameworkCore' into project 'C:\Projects\slivrr\slivrr.csproj'.
info : Restoring packages for C:\Projects\slivrr\slivrr.csproj...
info : Package 'Microsoft.EntityFrameworkCore' is compatible with all the specified frameworks in project 'C:\Projects\slivrr\slivrr.csproj'.
info : PackageReference for package 'Microsoft.EntityFrameworkCore' version '3.0.0-preview.18572.1' updated in file 'C:\Projects\slivrr\slivrr.csproj'.
info : Committing restore...
info : Writing assets file to disk. Path: C:\Projects\slivrr\obj\project.assets.json
log  : Restore completed in 220.26 ms for C:\Projects\slivrr\slivrr.csproj.

C:\Projects\slivrr>dotnet add package Microsoft.EntityFrameworkCore.Design --version 3.0.0-preview.18572.1
  Writing C:\Users\tonyleung.abc\AppData\Local\Temp\tmpAF16.tmp
info : Adding PackageReference for package 'Microsoft.EntityFrameworkCore.Design' into project 'C:\Projects\slivrr\slivrr.csproj'.
info : Restoring packages for C:\Projects\slivrr\slivrr.csproj...
info : Package 'Microsoft.EntityFrameworkCore.Design' is compatible with all the specified frameworks in project 'C:\Projects\slivrr\slivrr.csproj'.
info : PackageReference for package 'Microsoft.EntityFrameworkCore.Design' version

Open in new window

0
Hi experts,
First of all, I'm not a web developer.
I have a web-host account, a SQL database and a domain name. I need to do the following Max by tomorrow :)
- I need a very simple form consists of 4 or 5 fields to insert data.
- A save button to save data in database.
Or any other method to do the same through my webpage.

Thanks in advance,
Daniel Mina
0
on azure cloud web app service, what is the root directory of the website?
for example, i have website called abc.com\document\  is it like :c:\\IIS\document?
0

ASP.NET

125K

Solutions

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