Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x

ASP.NET

123K

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 this code and I need a css class to place a  red asterisk in front of label. For example *Field Rep.
The  asterisk should be bold

                  <div class="medium-3 column float left">
                        <label>
                            Field Rep
                        
                        
                        <asp:DropDownList ID="ddlFieldRep" runat="server">
                            <asp:ListItem Text="Select Field Rep" Value="0" Selected="True" />
                            <asp:ListItem Text="xxxx" Value="1" />
                            <asp:ListItem Text="llll" Value="2" />
                            <asp:ListItem Text="mmmm" Value="3" />
                        </asp:DropDownList>
                        
                        </label>

                    </div>

Open in new window

0
What does it mean to be "Always On"?
LVL 4
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

in my aspx, page I have a div, which I use to write html data being generated dynamically on the server side.

How can i open this html data in the div, in a new window/tab on a buttonclick.
0
I used this below in VB flavor and it worked perfectly.

                SqlCommand cmd = new SqlCommand();
                int taxPayerID = 0;
                cmd.CommandText = "usp_TaxPayer";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@taxPayerFullName", txtfname.Text);
                cmd.Parameters.AddWithValue("@address", txtfaddress.Text);
                cmd.Parameters.AddWithValue("@city", txtcity.Text);
                cmd.Parameters.AddWithValue("@state", ddlstates.SelectedValue);
                cmd.Parameters.AddWithValue("@zip", txtfzip.Text);
                cmd.Parameters.AddWithValue("@pid", accountnumber.Text);
                cmd.Parameters.AddWithValue("@phone", txtOwnerPhone.Text);
                cmd.Connection = conn;

                SqlParameter tID = cmd.Parameters.Add("@taxPayerID", SqlDbType.Int);
                tID.Direction = ParameterDirection.Output;
                cmd.ExecuteNonQuery();

                taxPayerID += Convert.ToInt32(tID.Value);

Open in new window


I converted to C# and now, I am getting an error that this:
taxPayerID += Convert.ToInt32(tID.Value);

Open in new window


Object cannot be cast from DBNULL to other types

Any ideas how to resolve?

Basically, I have one stored procedure that inserts records into the database and grabs the last inserted ID:
SET @taxPayerID = SCOPE_IDENTITY()

Open in new window


Then I am using that in another stored procedure:
ALTER PROCEDURE [dbo].[sp_saveMarineInfo] 
 @pid       int,
 @eID       int,
 @txYr        smallint,
 @marineRegno       varchar(50),
 @vesselRegno       varchar(50),
 @txretval          Money,
 @vtxretval         Money,
 @tID               int
AS
BEGIN
  SET NOCOUNT ON;
  begin tran
  if exists (select * from MarineInfo where pid = @pid)
   begin
    UPDATE MarineInfo SET TaxYear = @txYr
      ,marineRegNo = @marineRegno
	  ,vesselRegNo = @vesselRegno
      ,TaxPyrRetdVal = @txretval
	  ,VesselTaxPyrRetdVal =@vtxretval
       where pid = @pid
	end
    else
    begin
    INSERT INTO [dbo].MarineInfo
           (pid
           ,TaxYear
           ,marineRegNo
		   ,vesselRegNo
		   ,EquipmentTypeID
           ,TaxPyrRetdVal
		   ,VesselTaxPyrRetdVal
		   ,TaxPayerID
           )
     VALUES
           (@pid
           ,@txYr
           ,@marineRegno
		   ,@vesselRegno
		   ,@eID
           ,@txretval
		   ,@vtxretval
		   ,@tID
           )

Open in new window


With a parameter of tID and I am trying to assign a value from that parameter to tID in another insert statement but I can't get there because of the error from the first INSERT statement.

Please let me know if I need to clarify.
Thank  you
0
Hello Experts

I am getting a json response from a URL which I am trying parse it and capture code to store in the DB

Its returning the string ok but I am unable to remove the quoted strings to save the code in the DB
 

 Dim jResults As Object = JObject.Parse(Json)
        Dim jsonResulttodict = JsonConvert.DeserializeObject(Of Dictionary(Of String, Object))(Json)
        Dim firstItem = jsonResulttodict.Item("error")
        Dim seconditem = jsonResulttodict.Item("success")
        Dim thirditem = jsonResulttodict.Item("codes")

example string:

'{"error":"","success":"1 code generated successfully","codes":["QTESTA2HLT"]}


I am getting the code as [{  "QTESTA2HLT"  }]

Al I want is to read as QTESTA2HLT

please advise

thanks
0
I would like to do mobile app development using Xamarin connecting to an ASP.NET web service. Most likely the app would require an internet connection, not allowing local storage.

What do people typically do? Where do they host their web service portion? What database do they use?

I typically work with asp.net and sql server database, but don't know if people are using something different. And if I were to allow some local storage, what do they use for that?

thanks!
0
I am looking for hosting server recommendations.

Our project will involve:

ASP.NET framework
SQL Server database
Xamarin mobile app

Load Balancer
Firewall

Recommendations?

Thanks!
0
I have a CustomersController and MeetingsController. I want a link at the bottom that will redirect to the "Create" view based on the Id field of the Meeting Model. The way I have it written now, it redirects to the Create view in the MeetingsController, but does not save to the Id of the Customer.

(Note: I realize there is a lot of superfluous code. This is a work in progress and much of the code was created by default with the entity framework scaffolding.)

Here is the Customer Details view code. The Html.ActionLink is at the bottom of the page. That is where I want to redirect to the Create Meeting page but I want that meeting to be attached to the customer that is in the details view. I can post screenshots of the webpages if the community thinks that would be helpful.

Customer "Details" view:
@model WoodTrustCRM.Models.Customer

@{
    ViewBag.Title = "Details";
}

<h2>Customer Details</h2>

<div>
    <dl class="dl-horizontal">
        <dt>
            @Html.DisplayNameFor(model => model.SystemOfRecordId)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.SystemOfRecordId)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.Relationship)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.Relationship)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.Tin)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.Tin)
        </dd>

        <dt>
     

Open in new window

0
Dear,
I want to have the effect to disable further update (like to show gray background color), to whole page, when it's being idle for a while, by these

        .overlay {
            background: #e9e9e9;
            display: none;
            position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            opacity: 0.5;
        }
$(function () {
    // 1000ms=1s, here test use 10s, you could modify. 
    var time = 5000;
    var set = setInterval(function () {
        $(".overlay").show();
        $("#dialog").dialog();
    }, time);
});
    <div class="overlay">
        <div id="loading-img">
        </div>
    </div>

Open in new window

but I cannot get what I want, below
http://my-friend.co/RegRec2?id=18&user_abbr=mc2&readonly=n

what to adjust?
0
I have a asp.net (VB) web page where I'm uploading audio files to a folder in my web app, so for example my audio file would reside in '\Files\Music\myfile.mp3'.

I'm trying to use the <audio> tag to play the file on the same web page, when I do this on my dev machine everything is fine, but when I publish to production server the path is incorrect because the application is running under a root app, so when I try to load the file, the full 'Windows' path is prefixed so it now looks like: 'F:\Intranet\MyApp\Files\Music\myfile.mp3'

I've tried using server.mapPath and httpContext but neither is working for me.

How can I correctly reference the folder on the production server?

Thanks
0
I have a grid view in which I am using emptydatatemplate.  I am trying to use gridview.rowcommand to get data from textboxes in the empty data row.  The code behind (vb.net) gives me nothing when using FindControl to get the text from the text boxes in the gridview control.  Can anyone help PLEASE?  Below is my code:

<EmptyDataTemplate>
                <%--<asp:Table ID="EmptyDataTbl" runat="server" Visible="true">--%>
                    <asp:TableRow ID="TableRow6" runat="server" Width="100%">
                        <asp:TableCell ID="TableCell1" runat="server" Width="100%" ColumnSpan="16" HorizontalAlign="Left">
                            <asp:Label runat="server" ID="lblNoData" Text="No Data Available">
                            </asp:Label>
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow runat="server" Width="100%" BackColor="#FFB0C4DE" Height="28" ID="AddPtDtlTblRw">
                        <asp:TableCell ID="EmptyNameCell" runat="server" HorizontalAlign="Center" CssClass="VerticalGridlines" Width="5%">
                            <asp:LinkButton ID="EmptyNameBtn" runat="server" Text="Insert Detail" Font-Underline="True"
                                BorderStyle="None" BackColor="Transparent" CausesValidation="False" ForeColor="#003366"
                                CommandName="EmptyInsert" />
                        </asp:TableCell>
                        <asp:TableCell …
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!

say, I have an XML response file from a third party web service.

This contains a result of some operation which, I need to display it to a client. this third party has also provided me with  css and javascript files, which I use to display the response XML in a web browser.

my question is how can i write back a XML file to a web browser?
0
I have a SQL database using various models including Customer, Meeting, and Attachment. I have controllers set up for each one of those models. Everything is working great in the navigation properties and links.

I am working off a database that was created before my time. It is used by a custom application that I am replacing with an ASP.NET MVC website. The Attachment table has the columns: Id, Path, Name, Meeting. The path is a location to a share on our network. Rather than listing the path on the webpage, I would like the name of the Attachment in the Meetings/Details view to hyperlink to the location on the network share. I am perplexed on how to set this up.

I would also like the Meetings view to have a link to upload an attachment.

I have attached a screenshot of the model diagram. Model
This is what I have for my CustomersController:
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using WoodTrustCRM.Models;

namespace WoodTrustCRM.Controllers
{
    public class CustomersController : Controller
    {
        private WoodTrustCRMEntities db = new WoodTrustCRMEntities();

        // GET: Home - this is a view I created
        public ActionResult Home()
        {
            return View();
        }

        ////default GET: Customers
        //public ActionResult Index()
        //{
        //    return 

Open in new window

0
Hi Experts,

While exiting any page I want a message about unsaved work. So I am using the following code. It is showing me the message when there is any change in the form. But when I click "Leave this page" it does not leave the page it stays in the same page. Also When I click "Stay on this page" it gives me a java script error. Please suggest.

Thanks in advance.


  <script src="js/jquery.min.js"></script>
    <script>
        var dirtyScreen = false;
        $(document).ready(function () {
            $('input:not(:button,:submit),textbox,textarea,select').change(function () {
               dirtyScreen = true;
            });
           
        });
        var unloadEvent = function (e) {
            if (dirtyScreen) {
                var confirmationMessage = "Warning: Leaving this page will result in any unsaved data being lost. Are you sure you wish to continue?";
                (e || window.event).returnValue = confirmationMessage; //Gecko + IE
                return confirmationMessage; //Webkit, Safari, Chrome etc.
            };
        }
       
       window.addEventListener("beforeunload", unloadEvent);
</script>
0
I'm trying to add databinder into the hyperlink and getting this error

     <asp:HyperLink ID="hlinkFile" runat="server" NavigateUrl= "~/StudentDB/" + '<%#DataBinder.Eval(Container.DataItem, "FILE_LOCATION")%>'>">Open/Save</asp:HyperLink>

Open in new window

0
Dear,
I do not know why event cannot be fired below, after having clicked the button.

<input type="submit" name="LoginButton" value="登录" id="LoginButton" class="LoginButton" onclick="LoginButton_Click" style="font-weight: bold; position:fixed; top:30%;left:50%; z-index:1000"/>

Open in new window

0
Does anyone know how to use iframes with authorize.net. I have a website that has an iframe for payments. The problem is that when i press countinue it stays in the iframe. i want the iframe to close and but in the main web browser tab. i am using asp.net with c#
0
Hello everyone, I developed .rdlc report. I want to print all pages of my report on single page without page break between multiple pages. How can i do that? Please Help me.
Thanks in advance.
0
assume i have xml file call abc.xml

do you know any plug-in or app in c#/aspx.net that will create step by step form wizard based on the xml structure.
below we will start to read 'Notary' & 'CA' then i should have three steps

I just need some sort codes example to start.


<Sure>
      <Line>
        <Commercial>
          <Bond Name="Notary">
            <State name="CA"> 
              <Principal step="Step 1">
                <input type="text" class="" id="principalFirstName" placeholder="First Name" value=""></input>              
                <input type="text" class="" id="principalLastName" placeholder="Last Name" value=""></input>
                <input type="text" class="" id="principalMiddleName" placeholder="Middle Name" value=""></input>
                <input type="text" class="" id="principalCompanyName" placeholder="Company Name" value=""></input>
                <input type="text" class="" id="principalDBA" placeholder="DBA" value=""></input>
                <input type="text" class="" id="principalAddress" placeholder="Address" value=""></input>
                <input type="text" class="" id="principalCity" placeholder="City" value=""></input>
                <input type="text" class="" id="principalState" placeholder="State" value=""></input>
                <input type="text" class="" id="principalZip" placeholder="Zip" value=""></input>
                <input type="text" class="" id="principalPhoneNo" placeholder="Phone No" 

Open in new window

0
we want to see anyone has been developing web form /c# with edmunds api. They do not have .net/c# sample.
Assume we have <asp:net dropdown> and I just need to bind their car maker, model, and year.

c#, asp.net
0
Technology Partners: We Want Your Opinion!
Technology Partners: 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!

i have a asp.net mvc application.

I'm using the Employees table of the SQL Server Northwind database

My table looks like this:

table
Right now my dropdownlist displays  the EmployeeID

My razor code on my view looks like this:

@Html.DropDownListFor(model => model.EmployeeID, "Please Select an Employee: ", new { @class = "employeeclass1", @id = "EmployeeDDL" })


How do i set the default value on page load for my DDL to be 0?
How do I add a "ALL" text to my DDL so if someone selects that then the selected value for that is -2.

So then the only options my DDL would have are:
"Please Select an Employee:"  and the default selected value for this would be 0
"All" and the selected value for this would be -2
The other choices they would have are EmployeeID 1 through 9 which I already have and come from my model.
0
Good afternoon,
I'm having an issue here, I was assigned a project, I decided to use it to learn MVC as I was doing it. so what I'm saying is that I'm new to asp.net MVC.  I wont post my controller since its not been fire, I get the error before it fires my [httppost]
this is the error I'm getting: Unable to cast object of type 'System.Char' to type 'System.String'.
here is the models

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace BiciPublica.Models
{
    public class Usuario
    {
        public int Id { get; set; }
        
        [Required]
        [StringLength(80)]
        public string Nombres { get; set; }

        [Required]
        [StringLength(40)]
        [Display(Name ="Primer apellido")]
        public string PrimerApellido { get; set; }

        [Required]
        [StringLength(40)]
        [Display(Name = "Segundo apellido")]
        public string SegundoApellido { get; set; }

        [Required]
        [StringLength(30)]
        public string Cedula { get; set; }

        [Required]
        [Display(Name = "Fecha nacimiento ")]
        public DateTime FechaNacimiento { get; set; }

        [Required]
        [StringLength(5)]
        public string Rh { get; set; }

        [Required]
        [StringLength(10)]
        public char Genero { get; set; } 

        [Required]
        [StringLength(200)]
        [Display(Name = "Dirección")]
        public 

Open in new window

0
Hi Experts,

I am generating some labels as shown in Label1.png. My design is in Labeldesign.png.  My client needs the output in two columns as shown in Label_Desired.png. Please suggest is there any way to do it?

Thanks in advance.
Label1.png
LabelDesign.png
Label_Desired.png
0
Hi

I want to set Target Framework as .NET Standard 2.0 for my new .NET project. Where can I find the download so that I an install n my machine and use for new projects with .NET standard 2.0 as target .

Please se the attached,

Thanks
0
Dear,
Is there a way to save/store (within one button event) relevant latitude or longitude of the relevant position, already to the map below?

http://my-friend.co/RegRec2?id=18&user_abbr=mc2&readonly=n
0
Hello Experts,
In a Windows Service program, I am trying to delete a file.  It works fine in my machine.  For example if the file is found, my program  deletes it and if the file not found, I get exception.  Same program when copied to production, neither the file gets deleted, not do I get any exception.  I am sure it goes to delete portion of the method.  Because I tested it with log4net.  FYI, in development I am using Windows 7 Pro and in Production Windows Server 2008 R2.  Any idea?  Below is my code.  Please help.

Thank you in advance.


public void DeletePMTFile()
        {
            string fullName = System.Configuration.ConfigurationManager.AppSettings["FULL_NAME"];
            string filePath = System.Configuration.ConfigurationManager.AppSettings["FILE_PATH"];
            var reader = new StreamReader(fullName);
            reader.Close();

            FileInfo fileName = new FileInfo(fullName);
            if (File.Exists(fullName))
            {
                try
                {
                    Array.ForEach(Directory.GetFiles(filePath), File.Delete);
                }
                catch (System.IO.IOException e)
                {
                    log.Error("DeletePMTFile: Error while deleting the file" + e.Message);
                    return;
                }
            }
            else
            {
                log.Warn("DeletePMTFile: " + filePath.Trim() + " not found");
            }
        }

Open in new window

0

ASP.NET

123K

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