Subscribe: Custom Server Controls
http://forums.asp.net/rss.aspx?ForumID=19
Preview: Custom Server Controls

All Forums



All Forums



Last Build Date: Tue, 06 Dec 2016 10:04:35 -0800

 



Show popup and close it after 5 seg

2016-12-06T17:19:24.363-08:00

Hi

I'm new at Jquery and I found the following  post

http://stackoverflow.com/questions/10179040/jquery-dialog-open-and-automatically-close-after-3-seconds

with the code:

http://jsfiddle.net/WrdM9/2/

Here is my asp.net webpage

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="mensagem.aspx.vb" Inherits="mensagem" %>



    
   


    

But it doesn't work

Any help, please?




asp roles not working

2016-12-04T05:40:07.097-08:00

Hello,

I'm using vs2010 I'm having an issue, I have created an event for the login clicked on the asp.net login.  I'm trying to use if (user.isinrole("Sales")) Response.Redirect to a specific folder with a default page that I've created.  Although even trying to redirect to the asp.net about page doesn't work either.  If I type the page address in manually to the URL it works, however if I deny another role member in the web.config file it doesn't seem to deny them either.  What could I be doing wrong?

Thanks

George




JSON webservice

2016-12-06T09:50:44.31-08:00

I need to public a webservice that accept JSON POST to get records and write in sql table.

Normally I use SOAP and I don't know JSON but I've tried.

So I've build a webservice .ASMX file in ASP.NET and published a function with one parameter (string) in wich you can put JSON formatted string.

Then I deserialize string and write my record.

If I try using local browser it work.

But when I try to use JSON QUERY (application to call JSON webservice) not work.

What's wrong?

This is my code in webservice:

   _
    Public Function PutTrackInfo(ByVal strDataInfo As String) As Boolean

        Try
            Dim Posizione As Posizione = DirectCast(JsonConvert.DeserializeObject(strDataInfo, (GetType(Posizione))), Posizione)

            If Not Posizione Is Nothing Then
                Posizione.Save()

                Return True
            End If

        Catch ex As Exception
            Dim NuovoLog As New Log

            NuovoLog.Description = ex.Message
            NuovoLog.Data = Today
            NuovoLog.Save()
            Return False
        End Try

How I can publish my webservice to allow JSON post? 




Attendance Tracker Help using SQL

2016-12-06T16:09:52.75-08:00

I need help making an attendance tracking system where an someone can log in and input and track attendance.

I am using sql server for the tables. Right now, I have two tables done, one for classes and one for students.

My main trouble is making a clickable gridview, where I click can on classes. Once I click on a classes in gridview, all the students pop up for that class, once the students pop up, I can click on a specific student and change his/her attendance. I've been trying a gridview, but don't know how to connect both tables together, to use on gridview.




SQL Helper Connection String

2016-12-06T15:43:25.553-08:00

I am in the process of moving a bunch of old asp.net sites to a new server that no longer have source or project files available.  I spent days figuring out sqlconnection issues and fixing rewrites.

"Almost" everything is now working.  I had to hardcode in a new connection string to each file:

Dim MGSQLConnectionString As String = ConfigurationManager.ConnectionStrings("MGSQLConnectionString").ToString()

That works most everywhere, however, in some places of the code SQL Helper is being utilized to check data. Is there a way that I can "set" the connection string for SQLHelper too?  Code like below errors out because it can't connect to the database.  I have to do this for a lot of sites, so if there's a way to just set in one place for each site, it would be great.  Any advice would be greatly appreciated!!

Using sqlHelper As New SQLHelper
Dim dr As SqlClient.SqlDataReader
dr = sqlHelper.GetDataReader("SELECT * FROM Admin WHERE AdminID = " & adminID)
Do While dr.Read
txtName.Text = FixDBNulls(dr("Name"))
txtEmail.Text = FixDBNulls(dr("Email"))
cmdSubmit.Text = "Update"
Loop
dr.Close()
dr = Nothing
End Using




How to deploy Angular2 application built using AspNetCore in IIS

2016-12-05T19:05:49.757-08:00

I am facing some issues in deploying the Angular2 application built using AspNetCore in IIS.

I tried publishing the application using 'Publish' wizard in Visual Studio IDE. Copied the entire published contents and placed in the physical path mapped to a Virtual directory in IIS.

when I try to browse the Index.html page I am getting the following error "HTTP Error 404.0 - Not Found" as specified in the snapshot. Please find the virtual folder path structure in the snapshot.

Any ideas what is the mistake I am doing here and what is the correct way to deploy aspnetcore application in IIS?(image) (image)

My Startup.cs file is as below

public class Startup
    {
        public Startup(IHostingEnvironment env)
        {
            // Set up configuration sources.
            var builder = new ConfigurationBuilder()
                .SetBasePath(env.ContentRootPath)
                .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);

            builder.AddEnvironmentVariables();
            Configuration = builder.Build();
        }

        public IConfigurationRoot Configuration { get; set; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            // Add framework services.
            services.AddMvc();

        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            if (env.IsDevelopment())
            {
                app.UseBrowserLink();
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();
            app.Run(ctx =>
            {
                ctx.Response.Redirect("/index.html");
                return Task.FromResult(0);
            });
        }
    }



After upgrading to 1.1, can't get project to run - Fix my project.json

2016-12-04T19:58:19.323-08:00

I've spent WAY too much time trying to get this to work, so I'm throwing this out to the forums.  It's been two weeks without my website working and I'm fed up. This is a ASP.NET Core Web Application (.NET Framework). I was excited to see the new release, I downloaded it from the main page. https://www.microsoft.com/net/core#windowsvs2015 It's weird that it said that it's 1.1, but the link says  Download .NET Core 1.0.1 tools Preview 2 I went to NuGet Package Manager and it updated my references to 1.1 - But now I get many errors.   The one I'm stuck on is an old version of Logging.Abstractions, but searching everything including project.lock.json doesn't reveal any reference to it.  Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=1.0.0.0 I've also tried to make a new project and copy the project.json over, but that's not helping either.  Can someone show me where I went wrong?   Thanks! "dependencies": { "BundlerMinifier.Core": "2.2.306", "LinqKit.Microsoft.EntityFrameworkCore": "1.1.9", "Microsoft.AspNetCore.Authentication.Cookies": "1.1.0", "Microsoft.AspNetCore.Diagnostics": "1.1.0", "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.0", "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0", "Microsoft.AspNetCore.Mvc": "1.1.0", "Microsoft.AspNetCore.Razor.Tools": { "version": "1.0.0-preview2-final", "type": "build" }, "Microsoft.AspNetCore.Routing": "1.1.0", "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0", "Microsoft.AspNetCore.Server.Kestrel": "1.1.0", "Microsoft.AspNetCore.Session": "1.1.0", "Microsoft.AspNetCore.StaticFiles": "1.1.0", "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0", "Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0", "Microsoft.EntityFrameworkCore.Tools": { "version": "1.0.0-preview2-final", "type": "build" }, "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0", "Microsoft.Extensions.Configuration.Json": "1.1.0", "Microsoft.Extensions.Configuration.UserSecrets": "1.1.0", "Microsoft.Extensions.Logging": "1.1.0", "Microsoft.Extensions.Logging.Abstractions": "1.1.0", "Microsoft.Extensions.Logging.Console": "1.1.0", "Microsoft.Extensions.Logging.Debug": "1.1.0", "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0", "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0", "Microsoft.VisualStudio.Web.CodeGeneration.Tools": { "version": "1.0.0-preview2-final", "type": "build" }, "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": { "version": "1.0.0-preview2-final", "type": "build" }, "Sendgrid": "8.0.5", "Twilio": "4.7.2" }, "tools": { "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final", "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final", "Microsoft.[...]



Loading the XML into MVC model

2016-12-05T21:32:11.35-08:00

hi, I need to load the country and the corresponding state values from the xml tag CES into the MVC model . Basically the xml contains the country and state values.I need to show the country and state in two dropdown in mvc 4.0. On selecting the country on one dropdown , corresponding state values has to be shown in the another dropdown. Please help me  code snippet to load the data from the xml to the model. below is the xml and the code for model. XML Master page control and content page

2016-12-02T16:52:54.56-08:00

 I was assigned a task to add a checkbox to control a series of webpages. I created a copy of my current masterpage and for these 6 pages I'm going to use this version. I added the checkbox to the masterpage. When I load my first page it runs

-masterpage - Page_Load

-control(ascx) Page_Load

After the page loads I check the checkbox and it runs

-masterpage - Page_Load

-control(ascx) Page_Load

-masterpage - chkBox_CheckedChanged

I have to know that it was checked in the page_load of the control(ascx) page. How can I get this info before or during the controls page_load? The ascx file is registered and added to an aspx page call test.aspx.

Thank you 




Problem with Microsoft.Office.Interop.Word

2016-11-15T18:58:04.28-08:00

I have a c# web app that replaces placeholder texts with desired values in a word document. everything is working as it should be. I need to convert the word document after changes are done to PDF and send to browser so client can download.

problem is when the word document converts to pdf, the fonts that I used will convert to a default font courier new.

An important point that I need to point out is that when I change Identity to Interactive User in Component Service fonts are fine.

may be there is a permission issue to access fonts?

note: my OS is Win Server 2012, IIS App Pool Identity: Local service, also I've added full control permissions for Everyone and IIS in security tab

(image)




Using Repository Class And Business Logic Layer

2016-12-06T11:33:33.46-08:00

Hi all, I am not not sure how I would use the Repository pattern in MVC. It was clear when I was using web form but now I'm not sure if I should put everything inside of the Model.

I was thinking that perhaps I should  create a class library project for the Business Logic layer and put a Repository class in it. The Repository class will inherit from the DbContext class and the Repository class will contain code for CRUD operations. Then Entity framework will be installed in the Model and referenced by the Business Logic Layer.

Please point out if there is anything wrong with how I think a Repository should be used, thanks.




How to create select or insert Sqlserver in asp.net

2016-12-06T14:08:39.873-08:00

i want to build my asp.net application  inteaction with sql, i can insert delete or select ... that lile phpmyadmin.

in asp.net webforms how to do this, thanks in advance




Web Page has expired

2016-12-05T07:22:54.037-08:00

Hi Folks,

I am facing issue of Page as 'Web page expired' when I am trying to get back to previous page, Its working in Google Chrome but not working in Mozilla and IE.

Below is the line where I am clicking

Back

Please help on this..

Regards,

Ganesh




angularjs2 to post data to asp.net mvc controller

2016-12-04T17:49:40.77-08:00

Hi,

I am trying to post data from angularjs2 to asp.net mvc controller.

The actual issue is that when I am trying with it then

See how am I trying ?

this is the typescript ---

  save(company: Company): Observable {     
        let headers = new Headers({ 'Content-Type': 'application/json' });
         this._http.post(this._postUrl, /*JSON.stringify(*/company/*)*/, { headers: headers }) 
            .subscribe(
             (data) => {                 
                console.log('Response');               
                new Observable()
            },
             (err) => { console.log(err); new Observable(); },
            () => console.log('Complete')
            );         

         return new Observable();

          }

this is the call to this service function

 onSignUpClicked(message: string): void {
        this._service.save(this.company).subscribe(
           res => console.log(res),
            error => this.errorMessage = error
        );

When I am debugging it (typescript) then it shows

  1. ConfirmPassword:"123"
  2. Name:"dfgfgf"
  3. Password:"123"
  4. UserName:"rer@fgfg.com"

Now see when it takes the control in the server side (MVC controller action) then it doesn't fill that data in the c# class.

see the snip below

https://1drv.ms/i/s!AitLVJhHEke3gewZXrXatheLUUytcw

Kindly guide me.




Question on acepting long coma delimited csv string in body of post method

2016-12-02T04:36:27.96-08:00

Could someone help:  I have an  Angular 2 app with the following issue.  I would like to add functionality where the user can click a button and send a csv file as an attachtment via email.  From what I have found, this is not an easy task with Angular 2 or JavaScript. 

Thus my question:

Would it make sense for me to have an Web API POST method that accepts a long comma delimited string in the body (I would assume I need to set the Content-type: application/text to do that).  And then I could create the file and send the email in C#.  The bad part of this design is that First my Web API would be calling the db and sending a Json result, then the client would be sending the data back to the API as a coma delimited string to be converted to a file and emailed. 

Note: I thought about just sending the get parameter  and making the db call again, but these queries take long enough as it is and the delay could be an issue.

Any thoughts or advice would be greatly appreciated.

Thank You.




Is there a way to wire up the create button on and MVC create form to run a javascript function that is currently attached to a submit button that runs the function from a partial view?

2016-12-06T14:46:49.117-08:00

Hi All, thanks for viewing this question....

How would someone wire up a mvc create view button to run a function that was created and stored in a javascript file that is currently attached to partial view?

Currently there exist  have a partial view with the following code:

The function that it run is called GetRoute()

This was found on http://www.w3schools.com/jsref/event_onclick.asp

on W3schools they do show some examples but it is not clear how one would format it to work with the create form..

Will every button that is clicked fire off this code??? It's just not clear.

The mvc create view create button looks like this:





Things that have been tried have been: 

But this does not run the function, also their does not seem to be a onclick option... only ondblclick... which makes no sense.

By is everything so backward in ASP.MVC??  All that is needed is when the user clicks the create record button on the mvc View 

create view it run the bloody function.

The Goal is to not require the user to have to click the second button if possible... but maybe it is not possible?

This was found while researching for the solution if their is any: But the user did not give any indication on how to use

a listener.  

So if below is the solution could someone explain how to make this work. As you can see the original poster 

just said try this without any guidance as this is very generic. 

$(document).ready(function () {

myButton.onclick = function (event) {
// in here you can call an ajax method or just navigate to an action
return false;
}

// or using jQuery
$('#myButton').click(function (e) {
// do whatever here
e.GetRoute();
e.preventDefault;
});
});

Thanks in advance!




Help me please - The name 'ViewBag' does not exist in the current context

2016-12-05T20:34:02.92-08:00

Hi guys,

I can not show a page because of ViewBag.

I need it to pass the data to View.

Error List: My code: The name 'ViewBag' does not exist in the current context.

I have a Visual Studio 2015.

View

@{
    Layout = null;
}





    
    


    

@ViewBag.NotFound

Controller:

ViewBag.NotFound = "test string text";

I've tried everything on the internet. And nothing work.

Several attempts:

1 - I created a new mvc project, the same problem continues.

2 - devenv /ResetUserData

3- %LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache

4 - remove folder ".vs" and restar Visual studio.

Any ideas ?




Store view of a blog

2016-11-22T16:29:22.787-08:00

In my asp.net+Vb+Sql data base blog how can i store the views (how much vies did it make)




Could not create type ASMX

2016-12-06T14:48:31.773-08:00

I have an existing ASMX service which runs correctly. Recently i want to move it from the current project to a stand alone project.

The current structure is a Website which contains AsmxServices (Folder). Within this folder is the Customer folder containing the services.

Within the old site, in the App Code folder, there is a nested folder which contains the VB file the service calls.

I created a new Web Application project, referenced some of the dlls required and fixed all errors. I run the service and receive "Parser Error Message: Could not create type 'AsmxService/Customer/Service1'"

My Web Application project structure is

AsmxServices - Project name
  AsmxService - Folder
    Customer - Sub Folder
      Service1.vb 
      Service2.vb
      Service3.vb
      Service4.vb
Service1.asmx
Service2.asmx
Service3.asmx
Service4.asmx

In the asmx file i have the below declaration

<%@ WebService Language="VB" CodeBehind="~/AsmxServices/AsmxService/Customer/Service1.vb" Class="AsmxService/Customer/Service1" %>

but continue to get the error "Parser Error Message: Could not create type 'AsmxService/Customer/Service1'".

Ive changed this line

~/AsmxServices/AsmxService/Customer/Service1.vb

to

~/AsmxService/Customer/Service1.vb

but nothing seems to work. Anyway of narrowing down where the problem could be, or how to set the path?




xxx.aspx has not been pre-compiled, and cannot be requested

2016-12-06T15:32:55.483-08:00

After adding Crystal Report and publishing project to server windows 2008, I got an error:

xxx.aspx has not been pre-compiled, and cannot be requested.

The project in my pc is working well (windows 7 and vs2010)

How to fix it?