Subscribe: Web Forms
http://forums.asp.net/rss.aspx?ForumID=18
Added By: Feedage Forager Feedage Grade B rated
Language: English
Tags:
add  code  data  datatable  new  public  remove  row  runat server  runat  script  server  set public  set  test  text  web 
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: Web Forms

All Forums



All Forums



Last Build Date: Sat, 24 Sep 2016 19:32:19 -0700

 



Unable to provide back ground color in a table using knockout javascript

2016-09-22T07:49:33.2-07:00

      
                                    
                                         
                                     
                                                        
                                                        
                                        
                                    

Hello ,

The above code is for showing a table with two columns and based on EMP_ACTIVE value the rows will be in the table will have red or lightgreen color as backgroundcolor. The table gets populated fine . But the row color is always lightgreen even when the value is 0 . I am not sure whats the issue in the code .

Appreciate your help.

Thanks,

bala




IIS Windows Authentication

2016-09-21T02:39:41.747-07:00

I have MVC application and ASP.Net Web API running using Windows Authentication.

Disabled Anonymous Authentication and Enabled Windows.

What should be the recommended Identity of AppPool? Is it recommended to assign custom user account as App Pool's Identity instead of Network Service??




JQuery make user control in updatepanel not working (How do I fix this code)

2016-09-23T02:56:51.32-07:00

Hello

A click event on user controls inside the update panel is not working.

When I call Jquery (button1 in code ) I can't fire an event in user control

 

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

<%@ Register Src="~/test.ascx" TagPrefix="uc1" TagName="test" %>







    
    

    


    
 
<%--test.ascx--%>
<%@ Control Language="VB" ClassName="test" %>



Thank you




when update courses in EmployeeCourse table exception error generated on savechanges function

2016-09-21T16:08:24.5-07:00

Problem when i remove all courses for employee from EmployeeCourse table then add again i have exception error in save changes function details the logic used in code below for update is to delete all courses from EmployeeCourse table when click save button then add courses again to EmployeeCourse table after do changes by add or remove courses jquery employee course table have three fields Id,EmployeeId,CourseId(all fields not allow null) in edit [httppost] var emp = db.Employees.FirstOrDefault(f => f.Id == model.Id); // remove all courses foreach (EmployeeCourse eec in emp.EmployeeCourses.ToList()) { var ec = db.EmployeeCourses.Find(eec.Id); db.EmployeeCourses.Remove(ec); } // add courses again foreach (var couseid in model.CourseIds) { db.EmployeeCourses.Add(new EmployeeCourse { CourseId = couseid, EmployeeId = emp.Id }); } db.SaveChanges(); when add course and remove course client side jquery @model StudentCourses.Models.EditEmployeeVm $(function () { $(document).on("click", ".remove", function (e) { e.preventDefault(); $(this).closest(".course-item").remove(); }); $('#AvailableCourses').change(function () { var val = $(this).val(); var text = $("#AvailableCourses option:selected").text(); var existingCourses = $("input[name='CourseIds']") .map(function () { return this.value; }).get(); if (existingCourses.indexOf(val) === -1) { var newItem = $("
").addClass("course-item") .append(text + ' Remove '); newItem.append(''); $("#items").append(newItem); } }); }); to retrieve courses from database in edit view i used code below
@using (Html.BeginForm()) { @Html.HiddenFor(g => g.Id) @Html.LabelFor(f => f.Name) @Html.DropDownList("AvailableCourses", Model.Courses, "Select")

Existing courses

foreach (var c in Model.ExistingCourses) {
@c.Name Remove
} }
model used for that as following public class EditEmployeeVm { public int Id { set; get; } public List Courses { get; set; } public int[] CourseIds { set; get; } public List ExistingCourses { set; get; } } public class CourseVm { public int Id { set; get; } public string Name { set; get; } } } exception image below model class and code    in database employeecourse table have two forign keys EmployeeId,CourseId and two foreign keys not allow null
[...]



Publish to IIS Fails

2016-09-23T17:42:31.463-07:00

Hello Everyone

I have created a simple core web api. I have configured the IIS web site (http://localhost:port), changed to "No Managed Code".

When I try to deploy the web api from Visual Studio 2015 using publish it fails with the following error:

Web deployment task failed. (The specified credentials cannot be used with the authentication scheme 'Basic'.)

The specified credentials cannot be used with the authentication scheme 'Basic'. Default credentials cannot be supplied for the Basic authentication scheme.

Parameter name: authType

What am I missing?

Thanks




deserialize the below string...

2016-09-24T14:39:46.247-07:00

[{"id":7,"children":[{"id":4},{"id":2}]},{"id":1,"children":[{"id":5,"children":[{"id":3}]}]},{"id":6}]

I would like to get below format.

Parent  child

0          7

7          4

7          2

0          1

1          5

5          3

0          6




FormView - update with custom code?

2016-09-23T09:19:22.387-07:00

Hello,

I have a FormView, which is based on a SqlDataSource.
The SqlDataSource has a SelectCommand, but no UpdateCommand.

When the user edits the form and presses "update", I get an error message, because there is no update command.

However, in this case I cannot specify a single SQL command as the update command. Instead, I have to do it in C#.

How can I realize this?

Thanks
Magnus




SignalR Application Code Review

2016-09-24T22:12:17.867-07:00

Hello everyone! I've recently started with SignalR and have made a very small web app. You can see its humble beginnings here, rmmelendez.com/justforfun (please ignore the unfinished content on the root domain (image) ). The source code is here, github.com/rydez/signalrapp.

Essentially, all the app does is ask for your name, then places your name on the screen. You can move your name with WASD. It uses SignalR to make it possible for multiple people to join.

Being so new to SignalR, I'm here to ask for general advice. By looking at my source code, does anything pop-out as a bad practice? Or, are there certain practices that I should be exercising, but I'm not?

My next milestone will be adding unit tests, something I've never done before this project. So I feel that it would be best to make sure that I'm using SignalR correctly before I begin writing tests.

Thanks for taking the time to read this. Any advice at all would be very appreciated.




Server Date

2016-09-24T14:23:07.333-07:00

Hi

  I have the below properties .

[DataType(DataType.Date)]
public DateTime CreatedOnUtc { get; set; }

public bool Deleted { get; set; }

I want default Server Date should be stored when user Creates record. In Deleted i want default value False should be stored.

Thanks




Generate charts with asp.net Web forms

2016-09-24T19:42:42.34-07:00

I am developing CRM(customer relationship management) application and I want to display beauty-full charts in admin login dashboard page. Is there any examples of different look of charts and one of my friend told to me user High-carts.




Master / detial web form

2016-09-24T20:24:40.653-07:00

Hi
i need sample of master/ detial web form using. 2 table like order tabe and detial
Table and this web form use for example
Textbox for order number , text box customer and date box for order date ...etc

And grid view for for detial table having item name ,qty,price ...etc

And this sample in asp using vb

Many thank for any help

Ayman



'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.

2016-09-24T19:07:58.73-07:00

There is many (and I do mean MANY) page on the web telling how to fix this problem, none of them have worked for me.

This works fine on the LocalHost but as soon as I put it on the web (server is Windows 2012 net 4.5) I get the error

I have a very small (2 page) website made in Visual Studio 2012.
The website (2nd page) have a Gridview based on a table in an Access database (2007)

I am working on a laptop - 32bit

    
    
        
        
    


This is a really simple gridview so it should work ??


When I look at the page I see this error

System.InvalidOperationException: The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.

I have tried changing the ISS to any-cpu but this is no option to do this (many website are telling me to change this but the option is not there on IIS).
I have changed the VS dubug-configuration manager to any CPU
I have changed the VS dubug-configuration manager to any x86
etc.

nothing seems to work.

Any ideas please


This is my config file

  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

  
    
  
  
  
    
    
    
  
  
    
  










Capture image through web cam at Defined Time Intervals Automatically using asp.net c# web forms

2016-09-23T10:33:01.987-07:00

I have one online test website and I want to capture image through web cam at Defined Time Intervals Automatically using asp.net c# web forms and I need sample code using single .aspx page using sql.




Get into NHibernate

2016-09-23T20:14:01.47-07:00

What's up guys!

I need to learn NHibernate, I have a request to work with it instead of Entity Framework. Can someone direct me, guide me where to start to learn it, how to apply it in Asp.Net MVC?

I need to learn it but don't know where to start.




For Loop

2016-09-24T17:54:40.7-07:00

Hi Guys,

I have a problem on getting each row of the value from database.

i using store procedure to get the row i need and i and to loop each of data row that i been selected to 

do calculate the amount for can get the first row of the row and the rest is not getting it so how can i do to 

read each of the row that i have selected.

here the code

Using con As New SqlConnection(ConfigurationManager.ConnectionStrings("Client1").ConnectionString)
con.Open()
Using cmd As New SqlCommand("vSalaryIncrement", con)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@Mode", "SELECT")
cmd.Parameters.AddWithValue("@vID", ID)
cmd.Parameters.AddWithValue("@PageIndex", "")
cmd.Parameters.AddWithValue("@PageSize", "")
cmd.Parameters.AddWithValue("@RecordCount", "")

Dim reader As SqlDataReader = cmd.ExecuteReader
Dim myamount As String = 0


If reader.HasRows Then
For i = 0 To RecordCount - 1
myamount += Val(reader.Item("Amount"))
Next
End If
End Using
End Using

i got 6 row but it only get the 1 row of the data how can i get the rest of the data and calculate

Thank you

johnny




How to retrieve return value from store procedure and EF code first

2016-09-23T14:00:57.047-07:00

i how to call SQL server store proc by EF code first.

public class SalesPerson
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public decimal TotalSales { get; set; }
}

using (var context = new DBContext()) 
{ 
    var salesPeople = await context.Database.SqlQuery("AllSalesPeople").ToListAsync();
}

but when my SP return only one row which has 2 fields

DeptName and Empcount

for this i do not want to create to deserialize the data to there. so what would best idea to handle this. thanks




change the format of DataTable splitting the column in two

2016-09-24T15:27:39.69-07:00

I've a DataTable which format I need to change. The values of the DataTable are from the Database.  Current DataTable format CUSTOMER TYPE FEE NEW_FREE NEW_PAID OLD_FREE OLD_PAID GOLD 0 NULL NULL 2 NULL BRONZE 100 NULL 1 1 1 OTHERS 200 NULL NULL 1 NULL This DataTable shows the new & free customer type having free & paid registration. But I've to change the format of this DataTable to :: Required DataTable format     NEW OLD CUSTOMER TYPE FEE FREE PAID FREE PAID GOLD 0 NULL NULL 2 NULL BRONZE 100 NULL 1 1 1 OTHERS 200 NULL NULL 1 NULL The table top row should be to categorized as NEW/OLD customer and from the second row customer type and free and paid customer type. How can I do this? Code so far I've done :: CODE BEHIND :: protected void search_Click(object sender, EventArgs e) { // code blocks if (dt != null && dt.Rows.Count > 0) { DataView dv = dt.DefaultView; // Sort data dv.Sort = "CUSTOMER TYPE DESC"; // Convert back your sorted DataView to DataTable dt = dv.ToTable(); GridView1.DataSource = dt; GridView1.DataBind(); div_error.Visible = true; DataTable_Format(dt); } } protected void DataTable_Format(DataTable temp_dt) { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn() { DataType = typeof(string), ColumnName = "CUSTOMER TYPE" }); dt.Columns.Add(new DataColumn() { DataType = typeof(int), ColumnName = "FREE" }); dt.Columns.Add(new DataColumn() { DataType = typeof(int), ColumnName = "PAID" }); dt.Columns.Add(new DataColumn() { DataType = typeof(int), ColumnName = "FREE" }); dt.Columns.Add(new DataColumn() { DataType = typeof(int), ColumnName = "PAID" }); } My above code is not correct. I've just provided the code so far I tried to do. Further I've no idea how to proceed.  How can I categorized the top row of the table as NEW & OLD and the second row as CUSTOMER TYPE, FEE, and for NEW column two columns FREE & PAID and for OLD column again two columns FREE & PAID? Please help me. Thanks!!! [...]



Task Parallel Library

2016-09-24T06:01:16.643-07:00

Hi,

     i am having 3 tasks and written like this

var test=List

test.Add(object)

test.Add(object)

test.Add(object)

await Task.WhenAll(test.ToArray())

When any one of the task got failed,system execution stops and throws exception.How to overcome it and bypass the exception.

Please note that i have tried two exceptions invalid & argment exception catch..but both fails

 




WCF that take XML file as parameter and load XML data into SQL Server table

2016-09-23T20:00:10.17-07:00

Hello,

I try to create WCF web service to perform above task. I am wondering that the web service whether or not taking string xml or XML file as a parameter. 

I am sure that we can covert XML file to string type. 

Any expertise idea or how to create best WCF to load XML file data into SQL Server table, please guide me the right direction.

Thanks.




mvc pagination

2016-09-24T11:06:24.91-07:00

 job = entities.Jobs.Where(x => x.Industry.Industry1.StartsWith(searchTerm)).OrderBy(x => x.JobTitle).Skip(pageNumber - 1).Take(resultPerPage).ToList();

i am trying to implement pagination so that the data in the model job is not fetched all at a time,only that much data is fetched (resultPerPage) like if page no 1 is clicked and user has selected resultPerPage=5 so only 5 jobs are fetched from db, thrn if user selects page no 3 then data from 10-15 is fetched from db rather than fetching all data at same time and then applying paging to that. how can i achieve this, can  u provide some example?.

regards,

Sonam