Click here to Skip to main content
15,887,683 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Access data from a Web forms Website using a Windows App Pin
Wombaticus2-Dec-15 1:01
Wombaticus2-Dec-15 1:01 
GeneralRe: Access data from a Web forms Website using a Windows App Pin
jkirkerx2-Dec-15 6:30
professionaljkirkerx2-Dec-15 6:30 
AnswerRe: Access data from a Web forms Website using a Windows App Pin
David Mujica2-Dec-15 2:52
David Mujica2-Dec-15 2:52 
GeneralRe: Access data from a Web forms Website using a Windows App Pin
jkirkerx2-Dec-15 6:32
professionaljkirkerx2-Dec-15 6:32 
AnswerNot sure if its solved, but I got something to work Pin
jkirkerx2-Dec-15 13:00
professionaljkirkerx2-Dec-15 13:00 
GeneralRe: Not sure if its solved, but I got something to work Pin
Wombaticus3-Dec-15 6:16
Wombaticus3-Dec-15 6:16 
GeneralRe: Not sure if its solved, but I got something to work Pin
jkirkerx3-Dec-15 6:46
professionaljkirkerx3-Dec-15 6:46 
QuestionProblem with GreedView edit mode Pin
Member 1098582229-Nov-15 6:29
Member 1098582229-Nov-15 6:29 
Hi!

I'm trying to write a simple ASP.NET program that read data from wcf service and displays the data in GridView. WCF service works fine. It has simple interface:

C#
[OperationContract]
        List<EmployeeDetails> GetEmoloyeesDetails();

        [OperationContract]
        string ChangeEmployeeDetails(EmployeeDetails employeeInfo);

        [OperationContract]
        string AddEmployeeDetails(EmployeeDetails employeeInfo);

        [OperationContract]
        string DeleteEmployeeDetails(EmployeeDetails employeeInfo);


EmployeeDetails is set of string objects:

C#
[DataContract]
public class EmployeeDetails
{
    string employeeID = string.Empty;
    string firstName = string.Empty;
    string lastName = string.Empty;
    string birthDate = string.Empty;

    [DataMember]
    public string EmployeeID
    {
        get { return employeeID; }
        set { employeeID = value; }
    }

    [DataMember]
    public string FirstName
    {
        get { return firstName; }
        set { firstName = value; }
    }

    [DataMember]
    public string LastName
    {
        get { return lastName; }
        set { lastName = value; }
    }

    [DataMember]
    public string BirthDate
    {
        get { return birthDate; }
        set { birthDate = value; }
    }
}


Now I create ASP.NET with GridView:

ASP.NET
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication2.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:GridView ID="GridView1" runat="server" Width = "550px" AutoGenerateColumns = "true" Font-Names = "Arial"
            Font-Size = "11pt" AlternatingRowStyle-BackColor = "#C2D69B" 
            HeaderStyle-BackColor = "green" AllowPaging ="true"  ShowFooter = "true" PageSize = "10" onrowediting="EditEmployee"
            onrowcancelingedit="CancelEdit">
            <Columns>
                <asp:TemplateField ItemStyle-Width = "30px"  HeaderText = "FirstName">
                    <ItemTemplate>
                        <asp:Label ID="lblFirstName" runat="server"
                            Text='<%# Eval("FirstName")%>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:CommandField EditText="Edit" ShoweditButton="true" />
            </Columns>
        </asp:GridView>
    
    </div>

    </form>
</body>
</html>



This is simple test code (aspx.cs):

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication2
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        ServiceReference1.StaffAccountingServiceClient proxy = new ServiceReference1.StaffAccountingServiceClient();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindData();
            }
        }

        private void BindData()
        {
            GridView1.DataSource = proxy.GetEmoloyeesDetails();
            GridView1.DataBind();
        }

        protected void EditEmployee(object sender, GridViewEditEventArgs e)
        {

            GridView1.EditIndex = e.NewEditIndex;
            BindData();

        }

        protected void CancelEdit(object sender, GridViewCancelEditEventArgs e)
        {

            GridView1.EditIndex = -1;

            BindData();

        }
    }
}


I launch my ASP.NET client, and click on Edit link. And I see that dynamically created columns is in edit mode, but staticaly created columns is not Frown | :(

I need to create a static table with the ability to edit. This is example what I want to do:

http://www.aspsnippets.com/Articles/Simple-Insert-Select-Edit-Update-and-Delete-in-ASPNet-GridView-control.aspx[^]

The difference is that I use WCF service to interact with data base.

Please, help me! What could be the problem?

Thanks!

modified 29-Nov-15 12:38pm.

QuestionHow do I read contents of iis log in windows\system32\Logfiles\w3svc1? (SOLVED) Pin
samflex24-Nov-15 4:20
samflex24-Nov-15 4:20 
AnswerRe: How do I read contents of iis log in windows\system32\Logfiles\w3svc1? Pin
Richard Deeming24-Nov-15 9:02
mveRichard Deeming24-Nov-15 9:02 
GeneralRe: How do I read contents of iis log in windows\system32\Logfiles\w3svc1? Pin
samflex24-Nov-15 16:13
samflex24-Nov-15 16:13 
GeneralRe: How do I read contents of iis log in windows\system32\Logfiles\w3svc1? Pin
F-ES Sitecore24-Nov-15 22:25
professionalF-ES Sitecore24-Nov-15 22:25 
GeneralRe: How do I read contents of iis log in windows\system32\Logfiles\w3svc1? Pin
Richard Deeming25-Nov-15 2:38
mveRichard Deeming25-Nov-15 2:38 
GeneralRe: How do I read contents of iis log in windows\system32\Logfiles\w3svc1? Pin
samflex25-Nov-15 6:12
samflex25-Nov-15 6:12 
QuestionLinq query adding results to a new table Pin
byka23-Nov-15 9:51
byka23-Nov-15 9:51 
Questionasync and await in asp.net Pin
Anil Sharma198323-Nov-15 1:25
professionalAnil Sharma198323-Nov-15 1:25 
AnswerRe: async and await in asp.net Pin
Richard Deeming23-Nov-15 2:19
mveRichard Deeming23-Nov-15 2:19 
AnswerRe: async and await in asp.net Pin
ZurdoDev23-Nov-15 2:57
professionalZurdoDev23-Nov-15 2:57 
QuestionStudent Grade and Grade Point Callculation Pin
Aliyu Usman21-Nov-15 11:45
Aliyu Usman21-Nov-15 11:45 
AnswerRe: Student Grade and Grade Point Callculation Pin
Garth J Lancaster21-Nov-15 12:19
professionalGarth J Lancaster21-Nov-15 12:19 
QuestionStored Procedure returns no column in entity framework Pin
Er. Aamir Khan KCNIT Banda20-Nov-15 19:49
Er. Aamir Khan KCNIT Banda20-Nov-15 19:49 
AnswerRe: Stored Procedure returns no column in entity framework Pin
Richard MacCutchan20-Nov-15 21:55
mveRichard MacCutchan20-Nov-15 21:55 
GeneralRe: Stored Procedure returns no column in entity framework Pin
Er. Aamir Khan KCNIT Banda20-Nov-15 22:01
Er. Aamir Khan KCNIT Banda20-Nov-15 22:01 
AnswerRe: Stored Procedure returns no column in entity framework Pin
ZurdoDev23-Nov-15 2:58
professionalZurdoDev23-Nov-15 2:58 
QuestionChart Control Pin
BobbyStrain20-Nov-15 18:09
BobbyStrain20-Nov-15 18:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.