Subscribe: ASP.NET Forums
http://forums.asp.net/aggregaterss.aspx?Mode=0
Added By: Feedage Forager Feedage Grade B rated
Language: English
Tags:
application  code  net  new  null  page  public string  public  script  select  session  set public  set  string  text 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: ASP.NET Forums

All Forums



All Forums



Last Build Date: Fri, 20 Apr 2018 08:03:46 -0700

 



Stop Luftes dhe Varferise ne Bote

2018-04-20T14:53:35.11-07:00

Stop Luftes dhe Varferise ne Bote,duani njeri-tjetrin ashtu siç ju don ATI ZOT.

Kjo jete qe po jetoni eshte thjeshte nje pasazhe per nje jete me te mire ne AMSHIM !



"Jesus Christ"



What is default font family of hyperlink

2018-04-20T14:16:15.453-07:00

Hi All;

I have an MVC project.  It has set its HTML.ActionLinks set to a default font family and size.  I have a button that has been styled to look like a hyperlink.  But there are visible differences in the font family and size of the text indicating the button. 

Here is the code for that button:

    

I tried to find the style of the a tags in the css pages. but there is no mention of font size or family in all of those styles.

What is the default font size and family used by a link when it is not explicitly set?




Credit card payment using Merchant Account in asp.net c# application

2018-04-19T18:43:27.043-07:00

I am junior dot net developer, i need one help for to build simple e commerce asp.net application.

Trying to apply credit card payment using Merchant Account in asp.net application!  Can you please help me out that how can i make basic asp.net application for to use credit card payment and have every details of Merchant Account, i just need a system to take credit card payments.

I just want the simple application which can do credit card payments with my Merchant Account details!

Please help me out if you have any solution?!




How to Keep Session Alive Automatically

2018-04-19T18:38:26.78-07:00

Hi All,

please help

i just created a web medthod,  am expecting by reassigning the session value it will refresh the session

 [WebMethod(EnableSession = true)]
    public void refresh_session()
    {

    if( HttpContext.Current.Session["userID"]!=null)
        {
            string uid = HttpContext.Current.Session["userID"].ToString();
           

            HttpContext.Current.Session["userID"] = uid;
           
           

        }

      
    }

and am calling this method from an ajax call periodically

 var HeartBeatTimer;
 
    function StartHeartBeat()   // note this function is being called by onload method in body tag of this page
    {
       
        if (HeartBeatTimer == null)
            HeartBeatTimer = setInterval("HeartBeat()", 1000 * 300);
    }
 
   

        function HeartBeat() {

            $.ajax({ 

                contentType: 'application/json; charset=utf-8',
                url: 'refreshsession.asmx/refresh_session',
                type: 'POST',
                success: function (response) {

                  //  console.log(response.d);

                },
                error: function (xhr, textStatus, err) {

                }
            });
        }

i checked with console.log by returning value form web method it works fine with this call,

but session still expires after 20 minuts, what am doign wrong here?

any other solution to keep session alive till the browser is not closed

i dont want to use set session time out property to change default timeout ie to 30 of 60 minuts etc

Thanks




Remove script from a page or disable it's creation

2018-04-20T09:44:22.32-07:00

Hi,

i'm creating amp page with asp.net. I want to use a static master page and a second file that create the content of the page. If i use page_load event, the compiler append at the end of page this script:


Amp forbid custom script and at out of tag head, so i want to remove it. My idea is get all script registered to the page and remove it, or get the html code of the page after the creation, remove the code as a string and set back the page with the code modified. It is possible my solution or it can be done in another way?




Get Emails of all AD Users

2018-04-19T18:05:09.12-07:00

Hi there,

In my MVC app, I have an email textbox. How do I to get emails of all AD users and display as auto populate in Email text box? I have seen quite a few posts about getting the email of currently logged in user but nothing about getting  emails of all AD users. Is it possible?

Joe




Architecture and implimentation of signed document via USB Token

2018-04-20T11:40:29.347-07:00

Hi All,

I am developing an asp.net c# web-application to sign documents on the client side.

The client will use an USB dongle to sign the documents.

Any guidence is appreciated. 




chat application in asp.net c#

2018-04-20T14:04:58.21-07:00

hello please provide some source code of chat application 




AutoCompleteExtender service

2018-04-19T22:11:31.68-07:00

I have the following markup in my aspx webforms page to use for autocomplete textbox. I want it to get matching results from an sql stored procedure (also listed below). The stored procedure requires 2 variables and I cannot get it to work. Any help is appreciated.

p.s. If jquery code is better please point me to sample.

                            
                            
                            
                            

Below is my webservice

Imports System.Data.SqlClient
Imports System.Web.Services

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.





Public Class WebServiceFoods
    Inherits System.Web.Services.WebService

    
    Public Shared Function SearchFoods(ByVal prefixText As String, ByVal count As Integer) As List(Of String)
        Dim lstfoods As List(Of String) = New List(Of String)
        Using conData As SqlConnection = New SqlConnection(DBClass.GetKDConnectionString)
            conData.Open()
            Dim strSQL As String = "EXEC kd_selFoodItemsSearch @SearchText ='" & prefixText & "'"
            Dim cmd As SqlCommand = New SqlCommand
            cmd.CommandText = strSQL
            cmd.Parameters.AddWithValue("@SearchText", prefixText)
            cmd.Connection = conData
            Dim sdr As SqlDataReader = cmd.ExecuteReader
            While sdr.Read
                lstfoods.Add(sdr("FoodItem").ToString)
            End While
            sdr.Close()
        End Using

        Return lstfoods
    End Function

End Class

Below is my stored procedure

ALTER PROCEDURE [dbo].[kd_selFoodItemsSearch]
	@OrgID		int,
	@SearchText nvarchar(100) = null
	 
AS 

	BEGIN
	
		IF @SearchText IS NOT NULL
			BEGIN
				SET @SearchText = '%' + @SearchText + '%';
			END
			
		SELECT F.FoodID, 
			   F.CategoryID, 
			   F.FoodItem
		FROM dbo.tblFoods AS F
		WHERE (F.OrgID = 0 OR F.OrgID = @OrgID)
		  AND (CASE WHEN @SearchText IS NULL THEN 'T'
					WHEN @SearchText IS NOT NULL AND F.FoodItem LIKE @SearchText AND (F.OrgID = 0 OR F.OrgID = @OrgID) THEN 'T'
					ELSE 'F'
					END = 'T')
		ORDER BY F.FoodItem;
	
	END




Using arrayList as DataSource for Gridview

2018-04-20T13:19:04.94-07:00

Hi, Im trying to implement this way of populating a gridview https://aspdotnetcodebook.blogspot.com.ar/2008/07/using-arraylist-as-datasource-for.html but using 2 layer architecture (UI - BO).
BO has 2 class (Person.cs and PersonList.cs)
I want to move the method that create/retrieve the Session to the PersonList.cs and call it from the UI (Default.aspx.cs in the page load). Basically the same as in the page linked but using a layer for the objects (Person and PersonList which retrieves a Session Object populated with a List of Person?). 



connecting WPF client with .NETCore server

2018-04-20T13:50:11.127-07:00

I am trying to follow the pattern shown in this question:

AspNetCore.SignalR : Cannot start a connection that is not in the Initial state

where I'm using:

HubConnectionBuilder()

in my WPF client app (.NetFramework 4.7). To do this, it seems to me I need to add a reference to:

Microsoft.AspNetCore.SignalR.Client

in my WPF app.

However, I'm getting this error when I try to build:

System.IO.FileNotFoundException: Could not load file or assembly 'System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

Am I including the right package for WPF? Or should I be trying to solve the missing file issue? If the latter, how to I get the right file into my build?




How to set selected value from database for Html.DropDownList on pageload?

2018-04-19T14:27:05.603-07:00

I am populating a dropdownlist on an edit page from another table called UserAccounts in my database. Once the user is selected from this dropdownlist the selected value gets set as the owner field in the Todo table in my database. I have it so that this is working. The thing is when I click the edit page of a specific todo item, even when the owner of the todo is not null, the value of the dropdownlist gets set to "Select" because that is the default value of it. How do I code it so that if the Owner field is null, have it set to "Select" but if there is an owner in the field, I want the dropdownlist to be preselected as that owner? Controller: public ActionResult Edit(int? id, string owner) { if (Session["UserId"] != null) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } Todo todo = db.Todoes.Find(id); if (todo == null) { return HttpNotFound(); } var options = new List(); options.Add(new Todo() { Status = "New Request", Text = "New Request" }); options.Add(new Todo() { Status = "Reviewed", Text = "Reviewed" }); options.Add(new Todo() { Status = "Started", Text = "Started" }); options.Add(new Todo() { Status = "In Progress", Text = "In Progress" }); options.Add(new Todo() { Status = "Completed", Text = "Completed" }); ViewBag.Status = options; List osrListItems = db.UserAccounts.Where(w => w.OSR != null).Select(osr => new SelectListItem { Value = osr.OSR, Text = osr.OSR }).Distinct().ToList(); ViewBag.OSRddl = new SelectList(osrListItems, "Value", "Text").Distinct(); //string x = ViewBag.OSRddl.Value; //if (todo.Owner != null) //{ //} return View(todo); } else { return RedirectToAction("Login", "Account"); } } // POST: Todoes/Edit/5 // To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see https://go.microsoft.com/fwlink/?LinkId=317598. [HttpPost] [ValidateAntiForgeryToken] public ActionResult Edit([Bind(Include = "ID,Description,CreatedDate,Task,Status,FollowUp,Group,Owner")] string OSRddl, Todo todo) { if (Session["UserId"] != null) { //document.getElementById('FollowUp').value= if (ModelState.IsValid) { if (OSRddl != null) { todo.Owner = OSRddl; } db.Entry(todo).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(todo); } else { return RedirectToAction("Login", "Account"); } } View:
@*

Todo

*@
@Html.ValidationSummary(true, "", new { @class = "text-danger" }) @Html.HiddenFor(model => model.ID) [...]



Unable to increase the width of html drop-downs which are in Juqery data table

2018-04-19T14:32:41.353-07:00

Dear All,

I have drop-downs in my Jquery Data table and I tried the below css , But I found no luck.

Can any one suggest me how what's wrong .

select#txtparticipateidvalue{width:280%;
}
.txtparticipateidvalue select
{width:60px !important;
}


 




one-to-many relationship include and where

2018-03-22T22:45:20.983-07:00

Hi Everyone,

var products = unitOfWork.Products.GetAll()
.Include(i => i.ProductDetails).Where(d=>d.ProductDetails.Any(i=>i.LanguageId==2)).ToList(); 

I have these two tables. I want to write the following sql code with entityframework. I tried the above code that doesn't work. 

SELECT *
FROM [dbo].[Products] P
LEFT OUTER JOIN [dbo].[ProductDetails] PD ON P.ProductId = PD.ProductId
WHERE PD.LanguageId=2
namespace MIS.WebUI.Entity
{
    public class Product
    {
        public int ProductId { get; set; }
        public string ProductCode { get; set; }
        public string Image { get; set; }

        public ICollection ProductDetails { get; set; }
    }
}
namespace MIS.WebUI.Entity
{
    public class ProductDetail
    {
        public int ProductDetailId { get; set; }
        public int LanguageId { get; set; }
        public DateTime UpdateDate { get; set; }

        public string ProductName { get; set; }
        public string Description { get; set; }
        public string HtmlContent { get; set; }
        public double Price { get; set; }
        public int Currency { get; set; }
        public bool TaxIncluded { get; set; }

        public bool IsApproved { get; set; }
        public bool IsHome { get; set; }
        public bool IsFeatured { get; set; }

        public int? ProductId { get; set; }
        public Product Product { get; set; }

    }
}




ASP.NET Windows authentication and ASP.NET Identity

2018-04-20T05:31:21.653-07:00

I'm pretty new to ASP.NET MVC. I want to create Code First role based application with Windows authentication (Intranet users). I‘m using ASP.NET Identity framework and have created custom userStore and roleStore. I'm  stuck with how to configure that all new authenticated users will be added to userStore ?




Multiple Connection Strings in ASP.net Core

2018-04-19T21:45:46.33-07:00

Is there a way I can cycle through the connection strings in an appsettings.json file?

 "ConnectionStrings": {
    "DefaultConnection": "MyConnectionString",
   "ConnectionString2": "MyConnectionString"
  }




tree table bind data from sql db without entity frame work

2018-04-10T08:51:39.62-07:00

hi,

how can i create tree table bind from sql db into it but without using entity framework can anyone help me to do that?




Cannot insert duplicate key row in object 'dbo.TableName' with unique index

2018-04-19T01:14:49.21-07:00

CREATE UNIQUE CLUSTERED INDEX [IX_Daily_Checks_01] ON [dbo].[TableName] ( [CheckDate] ASC, [ServerName] ASC, [DBName] ASC, [CheckType] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)

insert into TableName select Date, ServerName, DBName, DBNum, CheckType, Message from Master.dbo.ChildTableName where Date between dateadd(hour, 12, (Convert(DateTime, DateDiff(day, 0, getdate() - 1)))) and dateadd(hour, 8, (Convert(DateTime, DateDiff(day, 0, GetDate()))))

Error connecting to server ServerName. Exception calling "WriteToServer" with "1" argument(s): "Cannot insert duplicate key row in object 'dbo.TableName' with unique index 'IX_Daily_Checks_01'. The duplicate key value is (2018-04-18 18:35:34.7200000, ServerName, , Backup AG).

Any inputs on resolving above issue with out changing index functionality?




Loading MetaData from Partial Class in Aspnet Core

2018-04-19T21:13:50.64-07:00

Hello everyone, I'm building a project in MVC template using AspNet Core.

I've used Entity Framework and I've scaffolded an existing DB. Now, I want to add some Data Annotations to some classes, but I don't wanna edit the class autogenerated by the scaffolding, so I've tried with the Metadata and the overriding of an existing method, the saveChanges().

Users.cs autogenerated by Scaffolding
public partial class Users
{
    public int UserId { get; set; }
    ...
    // If I have [MaxLength(5, ErrorMessage = "Too short")] here, it works
    public string Email { get; set; }
}

UsersMetadata.cs (also tried Users.Metadata.cs or else, nothing changed)
[ModelMetadataType(typeof(UsersModelMetaData))]
public partial class Users { }

public class UsersModelMetaData
{
    [MaxLength(5, ErrorMessage = "Too short")]
    public string Email { get; set; }
}

MyContext : DbContext Class
public override int SaveChanges()
{
    var entities = from e in ChangeTracker.Entries()
        where e.State == EntityState.Added
        || e.State == EntityState.Modified
        select e.Entity;
    foreach (var entity in entities)
    {
        var validationContext = new ValidationContext(entity);
        Validator.ValidateObject(entity, validationContext, validateAllProperties: true);
    }

    return base.SaveChanges();
}


So, even if this seems to be the correct solution (i've search all morning), it doesn't work: the problem seems to be that the Data Annotation inside UsersModelMetaData aren't read, because if I put the Data Annotation directly in Users.cs file, method saveChanges() will throw an exception.
Notice that I had to override the saveChanges() method because, as I understood, in AspNet Core there is no DbEntityValidationException, so in this way I can detect ValidationException.

I did found this solution -> https://stackoverflow.com/a/30127682/6070423 <- but it's based on AspNet, and using AspNet Core I cannot use AssociatedMetadataTypeTypeDescriptionProvider.

Any idea how I could resolve this?




enable disable textbox based on selection - jquery

2018-04-20T10:02:17.773-07:00

im trying to enable disable textboxes based on drop down selection , but its NOT working , and im NOT getting any errors in chrome browser code debugger , any suggestion , below is my code