Avatar billede train Nybegynder
25. november 2005 - 10:47 Der er 38 kommentarer og
1 løsning

checkbox i datagrid -udlæsning af db virker ikke visuelt i checkB

Jeg har lavet et datagrid hvor jeg har lavet den ene colum om til en checkbox med "Convert this column into a Template Colum" i IDE'en - jeg har fået lavet koden til at opdatere checkbox'en i databasen, og den virker fint.

Mit problem nu er at at checkboxen ikke viser hvad der reelt er i databasen i andet end det første felt.resten af column er bare et kopi visuelt af det første felt, uanset hvad databasen siger.

jeg kan stadig ændre alle felter med denne checkbox, selvom den "viser" som om det er første felt jeg editere.

Her er koden som jeg har fået lavet til at opdatere felterne.

tb er til editering af mine textbox felter i datagridet, cb er min checkbox.

private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
    int celle = 0;
    try
    {
        int alarmtempmin, alarmtempmax;
        string sensorname;
        bool state;

// Gets the value of the key field of the row being updated
string key = DataGrid1.DataKeys[e.Item.ItemIndex].ToString();
               

// Gets get the value of the controls (textboxes) that the user
// updated. The DataGrid columns are exposed as the Cells collection.
// Each cell has a collection of controls. In this case, there is only    one
// control in each cell -- a TextBox control. To get its value,
// you copy the TextBox to a local instance (which requires casting)
// and extract its Text property.
//
// The first column -- Cells(0) -- contains the Update and Cancel buttons.
TextBox tb;
CheckBox cb;

// Gets the value the TextBox control in the third column
tb = (TextBox)(e.Item.Cells[2].Controls[0]);
alarmtempmin = Convert.ToInt16(tb.Text);
tb.BackColor = Color.White;
celle++;

// Gets the value the TextBox control in the fourth column
tb = (TextBox)(e.Item.Cells[3].Controls[0]);
alarmtempmax = Convert.ToInt16(tb.Text);
tb.BackColor = Color.White;
celle++;

// Gets the value the TextBox control in the fifth column
tb = (TextBox)(e.Item.Cells[4].Controls[0]);
sensorname = tb.Text;
tb.BackColor = Color.White;
               
// Gets the value the CheckBox control in the sixth colum
cb = (CheckBox)(e.Item.Cells[5].Controls[1]);
if (cb.Checked)
state = true;
else
state = false;
               
// Finds the row in the dataset table that matches the
// one the user updated in the grid. This example uses a
// special Find method defined for the typed dataset, which
// returns a reference to the row.
myDataSet.tempsensorRow r;
r = myDataSet1.tempsensor.FindByautoID(int.Parse(key));

// Updates the dataset table.
r.alarmtempmin = alarmtempmin;
r.alarmtempmax = alarmtempmax;
r.sensorname = sensorname;
r.state = state;

// Calls a SQL statement to update the database from the dataset
jr.Component1 myComponent = new Component1();
myComponent.sqlDataAdapter1.Update(myDataSet1);

           
// Takes the DataGrid row out of editing mode
DataGrid1.EditItemIndex = -1;

// Refreshes the grid
DataGrid1.DataBind();


celle = 0;
}
catch (FormatException e2)
{
TextBox tb;
    tb = (TextBox)(e.Item.Cells[celle+2].Controls[0]);
    tb.BackColor=Color.Red;
                       
}
Avatar billede dr_chaos Nybegynder
25. november 2005 - 11:50 #1
hvad kode bruger du til at sætte værdier på checkboxen med ?
Avatar billede train Nybegynder
25. november 2005 - 12:46 #2
det er det der mangler :/
Avatar billede dr_chaos Nybegynder
25. november 2005 - 12:49 #3
du skal en bool værdi fra din database.
((CheckBox)(e.Item.Cells[5].Controls[1])).Checked = dinboolværdi;
Avatar billede train Nybegynder
25. november 2005 - 13:35 #4
((CheckBox)(e.Item.Cells[5].Controls[1])).Checked = state;  må så være den bool jeg skal kigge på - men hvor skal jeg have smidt den fine linje kode hen ?
Avatar billede dr_chaos Nybegynder
25. november 2005 - 15:56 #5
der hvor du indlæser data i datagriddet.
Avatar billede train Nybegynder
25. november 2005 - 16:27 #6
eftersom jeg har brugt IDE'en til at generere Datagrid og brugt(property builder) til at indlæse data i griddet er jeg lidt på bar bund hvor det gøres i koden :/


(stadig helt ny i C# .NET, men det har du vel gættet ;) )
Avatar billede dr_chaos Nybegynder
28. november 2005 - 15:27 #7
gider du ikke kopierer hele koden fra aspx filen og hele koden fra codebehind filen her ind ?
Avatar billede train Nybegynder
28. november 2005 - 17:22 #8
det her er min webform1.aspx.cs:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;



               

namespace jr
{
    /// <summary>
    /// Summary description for WebForm1.
    /// </summary>
    public class WebForm1 : System.Web.UI.Page
    {
        protected System.Web.UI.WebControls.DataGrid DataGrid1;
        protected System.Web.UI.WebControls.Label Label1;
        protected System.Web.UI.WebControls.DataGrid DataGrid2;
        protected jr.myDataSet myDataSet1;
        protected System.Web.UI.WebControls.Button ButtonRefresh;
        protected Component1 myComponent = new Component1();
        protected jr.myDataSetList myDataSetList1;
        protected System.Web.UI.WebControls.DataGrid DataGrid3;
        protected jr.myDataSetRelay myDataSetRelay1;
/// </summary>
            private void Page_Load(object sender, System.EventArgs e)
        {
            myComponent.FillDataSet(myDataSet1);
            myComponent.FillDataSet(myDataSetList1);
            myComponent.FillDataSet(myDataSetRelay1);
           
            if (!IsPostBack)
            {
               
                DataGrid1.DataBind();
                DataGrid2.DataBind();
                DataGrid3.DataBind();
                Label1.DataBind();
               
            }

           
        }

        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }
       
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {   
            this.myDataSet1 = new jr.myDataSet();
            this.myDataSetList1 = new jr.myDataSetList();
            this.myDataSetRelay1 = new jr.myDataSetRelay();
            ((System.ComponentModel.ISupportInitialize)(this.myDataSet1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.myDataSetList1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.myDataSetRelay1)).BeginInit();
            this.ButtonRefresh.Click += new System.EventHandler(this.ButtonRefresh_Click);
            this.DataGrid1.CancelCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_CancelCommand);
            this.DataGrid1.EditCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_EditCommand);
            this.DataGrid1.UpdateCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_UpdateCommand);
            this.DataGrid1.SelectedIndexChanged += new System.EventHandler(this.DataGrid1_SelectedIndexChanged);
            this.DataGrid3.CancelCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid3_CancelCommand);
            this.DataGrid3.EditCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid3_EditCommand);
            this.DataGrid3.UpdateCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid3_UpdateCommand);
            this.DataGrid3.SelectedIndexChanged += new System.EventHandler(this.DataGrid3_SelectedIndexChanged);
            //
            // myDataSet1
            //
            this.myDataSet1.DataSetName = "myDataSet";
            this.myDataSet1.Locale = new System.Globalization.CultureInfo("da-DK");
            //
            // myDataSetList1
            //
            this.myDataSetList1.DataSetName = "myDataSetList";
            this.myDataSetList1.Locale = new System.Globalization.CultureInfo("da-DK");
            //
            // myDataSetRelay1
            //
            this.myDataSetRelay1.DataSetName = "myDataSetRelay";
            this.myDataSetRelay1.Locale = new System.Globalization.CultureInfo("da-DK");
            this.Load += new System.EventHandler(this.Page_Load);
            ((System.ComponentModel.ISupportInitialize)(this.myDataSet1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.myDataSetList1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.myDataSetRelay1)).EndInit();

        }
        #endregion

        private void DataGrid1_SelectedIndexChanged(object sender, System.EventArgs e)
        {
       
        }

        private void DataGrid1_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            DataGrid1.EditItemIndex = e.Item.ItemIndex;
            DataGrid1.DataBind();
           
        }

        private void DataGrid1_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            DataGrid1.EditItemIndex = -1;
            DataGrid1.DataBind();
        }

       
        private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
           
            int celle = 0;
            try
            {
                int alarmtempmin, alarmtempmax;
                int temp;
                string sensorname;
                bool state;

                // Gets the value of the key field of the row being updated
                string key = DataGrid1.DataKeys[e.Item.ItemIndex].ToString();
               

                // Gets get the value of the controls (textboxes) that the user
                // updated. The DataGrid columns are exposed as the Cells collection.
                // Each cell has a collection of controls. In this case, there is only one
                // control in each cell -- a TextBox control. To get its value,
                // you copy the TextBox to a local instance (which requires casting)
                // and extract its Text property.
                //
                // The first column -- Cells(0) -- contains the Update and Cancel buttons.
                TextBox tb;
                CheckBox cb;
                // Gets the value the TextBox control in the third column
               
                tb = (TextBox)(e.Item.Cells[3].Controls[0]);
                temp= int.Parse(tb.Text);
                if(temp<=125 && temp >=-55)
                    alarmtempmin = Convert.ToInt16(tb.Text);
                else
                    {
                        throw(new FormatException(""));
                    }
                tb.BackColor = Color.White;
                celle++;

                // Gets the value the TextBox control in the fourth column
                tb = (TextBox)(e.Item.Cells[4].Controls[0]);
                temp= int.Parse(tb.Text);
               
                if(temp<=125 && temp >=-55)
                    alarmtempmax = Convert.ToInt16(tb.Text);
                else
                {
                    throw(new FormatException(""));
                }
                tb.BackColor = Color.White;
                celle++;
           
                // Gets the value the TextBox control in the fifth column
                tb = (TextBox)(e.Item.Cells[2].Controls[0]);
                sensorname = tb.Text;
                tb.BackColor = Color.White;
               
                // Gets the value the CheckBox control in the sixth colum
                cb = (CheckBox)(e.Item.Cells[5].Controls[1]);
                if (cb.Checked)
                    state = true;
                else
                    state = false;
               
                // Finds the row in the dataset table that matches the
                // one the user updated in the grid. This example uses a
                // special Find method defined for the typed dataset, which
                // returns a reference to the row.
                myDataSet.tempsensorRow r;
                r = myDataSet1.tempsensor.FindByautoID(int.Parse(key));

                // Updates the dataset table.
                r.alarmtempmin = alarmtempmin;
                r.alarmtempmax = alarmtempmax;
                r.sensorname = sensorname;
                r.state = state;

                // Calls a SQL statement to update the database from the dataset
                jr.Component1 myComponent = new Component1();
                myComponent.sqlDataAdapter1.Update(myDataSet1);

           
                // Takes the DataGrid row out of editing mode
                DataGrid1.EditItemIndex = -1;
                ((CheckBox)(e.Item.Cells[5].Controls[1])).Checked = state;
               
                // Refreshes the grid
                DataGrid1.DataBind();
                DataGrid2.DataBind();
               
               
                // reset catch cell counter
                celle = 0;
            }
            catch (FormatException)
            {
                TextBox tb;
                tb = (TextBox)(e.Item.Cells[celle+3].Controls[0]);
                tb.BackColor=Color.Red;
                tb.Text ="Wrong value";
                                                       
            }
           
            // Prøver at opdatere Datagrid2 efter endt update - virker ikke hver gang
            DataGrid2.DataBind();
           
           
        }

        private void ButtonRefresh_Click(object sender, System.EventArgs e)
        {
            DataGrid2.DataBind();
        }
        private void DataGrid3_SelectedIndexChanged(object sender, System.EventArgs e)
        {
       
        }

        private void DataGrid3_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            DataGrid3.EditItemIndex = e.Item.ItemIndex;
            DataGrid3.DataBind();

        }

        private void DataGrid3_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            DataGrid3.EditItemIndex = -1;
            DataGrid3.DataBind();

        }
       
        private void DataGrid3_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            int celle = 0;
            try
            {
               
                string relayname;
//                bool relaystate;

                // Gets the value of the key field of the row being updated
                string key = DataGrid3.DataKeys[e.Item.ItemIndex].ToString();
                           

                // Gets get the value of the controls (textboxes) that the user
                // updated. The DataGrid columns are exposed as the Cells collection.
                // Each cell has a collection of controls. In this case, there is only one
                // control in each cell -- a TextBox control. To get its value,
                // you copy the TextBox to a local instance (which requires casting)
                // and extract its Text property.
                //
                // The first column -- Cells(0) -- contains the Update and Cancel buttons.
                TextBox tb;
//                CheckBox cb;
                // Gets the value the TextBox control in the third column
               
        /*        tb = (TextBox)(e.Item.Cells[3].Controls[0]);
                temp= int.Parse(tb.Text);
                if(temp<=125 && temp >=-55)
                    alarmtempmin = Convert.ToInt16(tb.Text);
                else
                {
                    throw(new FormatException(""));
                }
                tb.BackColor = Color.White;
                celle++;

                // Gets the value the TextBox control in the fourth column
                tb = (TextBox)(e.Item.Cells[4].Controls[0]);
                temp= int.Parse(tb.Text);
               
                if(temp<=125 && temp >=-55)
                    alarmtempmax = Convert.ToInt16(tb.Text);
                else
                {
                    throw(new FormatException(""));
                }
                tb.BackColor = Color.White;
                celle++;
                /*alarmtempmax = Convert.ToInt16(tb.Text);
                tb.BackColor = Color.White;
                celle++;
*/
                // Gets the value the TextBox control in the fifth column
                tb = (TextBox)(e.Item.Cells[2].Controls[0]);
                relayname = tb.Text;
                tb.BackColor = Color.Red;
               
               
                // Gets the value the CheckBox control in the sixth colum
/*                cb = (CheckBox)(e.Item.Cells[5].Controls[1]);
                if (cb.Checked)
                    state = true;
                else
                    state = false;
    */           
                // Finds the row in the dataset table that matches the
                // one the user updated in the grid. This example uses a
                // special Find method defined for the typed dataset, which
                // returns a reference to the row.
                myDataSetRelay.relayRow r;
                r = myDataSetRelay1.relay.FindByrelayID(int.Parse(key));

               

                // Updates the dataset table.
    //            r.alarmtempmin = alarmtempmin;
    //            r.alarmtempmax = alarmtempmax;
                r.relayname = relayname;
    //            r.relaystate = relaystate;

                // Calls a SQL statement to update the database from the dataset
                jr.Component1 myComponent = new Component1();
                myComponent.sqlDataAdapter3.Update(myDataSetRelay1);

                // Takes the DataGrid row out of editing mode
                DataGrid3.EditItemIndex = -1;
            //    ((CheckBox)(e.Item.Cells[5].Controls[1])).Checked = relaystate;
               
                // Refreshes the grid
                DataGrid3.DataBind();
               
                // reset catch cell counter
                celle = 0;
            }
            catch (FormatException)
            {
                TextBox tb;
                tb = (TextBox)(e.Item.Cells[celle+2].Controls[0]);
                tb.BackColor=Color.Red;
                tb.Text ="Wrong value";
                                                       
            }
           
            // Prøver at opdatere Datagrid2 efter endt update - virker ikke hver gang
            DataGrid3.DataBind();
           
           
        }

       
    }
}


vdr codebehind ...  ingen ide hvad det er jeg skal kigge efter der :/  sorry
Avatar billede dr_chaos Nybegynder
28. november 2005 - 17:26 #9
det er code behind jeg skal bruge koden til  webform1.aspx
Avatar billede train Nybegynder
29. november 2005 - 08:42 #10
Jeg håber det er det her du mener.

<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="jr.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
    <HEAD>
        <title>WebForm1</title>
        <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
        <meta content="C#" name="CODE_LANGUAGE">
        <meta content="JavaScript" name="vs_defaultClientScript">
        <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
        <form id="Form1" method="post" runat="server">
            <asp:label id="Label1" style="Z-INDEX: 101; LEFT: 424px; POSITION: absolute; TOP: 312px" runat="server"
                Width="88px" Height="32px"></asp:label><asp:button id="ButtonRefresh" style="Z-INDEX: 104; LEFT: 416px; POSITION: absolute; TOP: 376px"
                runat="server" Text="Refresh tempeture stats"></asp:button><asp:datagrid id=DataGrid1 style="Z-INDEX: 102; LEFT: 48px; POSITION: absolute; TOP: 64px" runat="server" Width="466px" Height="176px" GridLines="None" CellPadding="3" BackColor="White" CellSpacing="1" BorderWidth="2px" BorderStyle="Ridge" BorderColor="White" AutoGenerateColumns="False" DataSource="<%# myDataSet1 %>" DataKeyField="autoID" DataMember="tempsensor">
                <FooterStyle ForeColor="Black" BackColor="#C6C3C6"></FooterStyle>
                <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#9471DE"></SelectedItemStyle>
                <ItemStyle ForeColor="Black" BackColor="#DEDFDE"></ItemStyle>
                <HeaderStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="#E7E7FF" VerticalAlign="Middle"
                    BackColor="#4A3C8C"></HeaderStyle>
                <Columns>
                    <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
                    <asp:BoundColumn Visible="False" DataField="tempsensorID" SortExpression="tempsensorID" HeaderText="tempsensorID"></asp:BoundColumn>
                    <asp:BoundColumn DataField="sensorname" HeaderText="sensorname"></asp:BoundColumn>
                    <asp:BoundColumn DataField="alarmtempmin" HeaderText="alarmtempmin"></asp:BoundColumn>
                    <asp:BoundColumn DataField="alarmtempmax" HeaderText="alarmtempmax"></asp:BoundColumn>
                    <asp:TemplateColumn HeaderText="Alarm ON/OFF">
                        <ItemTemplate>
                            <asp:CheckBox id=CheckBox2 runat="server" Text='<%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].DefaultView.[0].state") %>' Checked='<%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].DefaultView.[0].state") %>' Enabled="False">
                            </asp:CheckBox>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:CheckBox id=CheckBox1 runat="server" Checked='<%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].DefaultView.[0].state") %>'>
                            </asp:CheckBox>
                        </EditItemTemplate>
                    </asp:TemplateColumn>
                    <asp:BoundColumn DataField="state" SortExpression="state" HeaderText="Alarm ON?"></asp:BoundColumn>
                </Columns>
                <PagerStyle HorizontalAlign="Right" ForeColor="Black" BackColor="#C6C3C6"></PagerStyle>
            </asp:datagrid><asp:datagrid id=DataGrid2 style="Z-INDEX: 103; LEFT: 48px; POSITION: absolute; TOP: 280px" runat="server" Width="328px" Height="138px" GridLines="None" CellPadding="3" BackColor="White" CellSpacing="1" BorderWidth="2px" BorderStyle="Ridge" BorderColor="White" AutoGenerateColumns="False" DataSource="<%# myDataSetList1 %>" DataKeyField="tempsensorlogID">
                <FooterStyle ForeColor="Black" BackColor="#C6C3C6"></FooterStyle>
                <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#9471DE"></SelectedItemStyle>
                <ItemStyle ForeColor="Black" BackColor="#DEDFDE"></ItemStyle>
                <HeaderStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="#E7E7FF" VerticalAlign="Middle"
                    BackColor="#4A3C8C"></HeaderStyle>
                <Columns>
                    <asp:BoundColumn Visible="False" DataField="tempsensorlogID" HeaderText="tempsensorlogID"></asp:BoundColumn>
                    <asp:BoundColumn DataField="sensorname" SortExpression="sensorname" HeaderText="sensorname"></asp:BoundColumn>
                    <asp:BoundColumn DataField="temperature" SortExpression="temperature" HeaderText="temperature"></asp:BoundColumn>
                    <asp:BoundColumn DataField="timestamp" SortExpression="timestamp" HeaderText="timestamp"></asp:BoundColumn>
                </Columns>
                <PagerStyle HorizontalAlign="Right" ForeColor="Black" BackColor="#C6C3C6"></PagerStyle>
            </asp:datagrid><asp:datagrid id=DataGrid3 style="Z-INDEX: 105; LEFT: 648px; POSITION: absolute; TOP: 280px" runat="server" GridLines="Vertical" CellPadding="3" BackColor="White" BorderWidth="1px" BorderStyle="None" BorderColor="#999999" AutoGenerateColumns="False" DataSource="<%# myDataSetRelay1 %>" DataKeyField="relayID" DataMember="relay" HorizontalAlign="Center">
                <FooterStyle ForeColor="Black" BackColor="#CCCCCC"></FooterStyle>
                <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#008A8C"></SelectedItemStyle>
                <AlternatingItemStyle BackColor="#DCDCDC"></AlternatingItemStyle>
                <ItemStyle ForeColor="Black" BackColor="#EEEEEE"></ItemStyle>
                <HeaderStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="White" VerticalAlign="Middle"
                    BackColor="#000084"></HeaderStyle>
                <Columns>
                    <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
                    <asp:BoundColumn DataField="relayID" HeaderText="relayID"></asp:BoundColumn>
                    <asp:BoundColumn DataField="relayname" HeaderText="relayname"></asp:BoundColumn>
                    <asp:BoundColumn DataField="relaystate" HeaderText="relaystate"></asp:BoundColumn>
                </Columns>
                <PagerStyle HorizontalAlign="Center" ForeColor="Black" BackColor="#999999" Mode="NumericPages"></PagerStyle>
            </asp:datagrid></form>
    </body>
</HTML>
Avatar billede dr_chaos Nybegynder
29. november 2005 - 10:18 #11
det er den. prøv lige at benytte nedenstående kode.
Får du de rigtige true false værdier vist hvor checkboxen plejede at være ?
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="jr.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
    <HEAD>
        <title>WebForm1</title>
        <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
        <meta content="C#" name="CODE_LANGUAGE">
        <meta content="JavaScript" name="vs_defaultClientScript">
        <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
        <form id="Form1" method="post" runat="server">
            <asp:label id="Label1" style="Z-INDEX: 101; LEFT: 424px; POSITION: absolute; TOP: 312px" runat="server"
                Width="88px" Height="32px"></asp:label><asp:button id="ButtonRefresh" style="Z-INDEX: 104; LEFT: 416px; POSITION: absolute; TOP: 376px"
                runat="server" Text="Refresh tempeture stats"></asp:button><asp:datagrid id=DataGrid1 style="Z-INDEX: 102; LEFT: 48px; POSITION: absolute; TOP: 64px" runat="server" Width="466px" Height="176px" GridLines="None" CellPadding="3" BackColor="White" CellSpacing="1" BorderWidth="2px" BorderStyle="Ridge" BorderColor="White" AutoGenerateColumns="False" DataSource="<%# myDataSet1 %>" DataKeyField="autoID" DataMember="tempsensor">
                <FooterStyle ForeColor="Black" BackColor="#C6C3C6"></FooterStyle>
                <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#9471DE"></SelectedItemStyle>
                <ItemStyle ForeColor="Black" BackColor="#DEDFDE"></ItemStyle>
                <HeaderStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="#E7E7FF" VerticalAlign="Middle"
                    BackColor="#4A3C8C"></HeaderStyle>
                <Columns>
                    <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
                    <asp:BoundColumn Visible="False" DataField="tempsensorID" SortExpression="tempsensorID" HeaderText="tempsensorID"></asp:BoundColumn>
                    <asp:BoundColumn DataField="sensorname" HeaderText="sensorname"></asp:BoundColumn>
                    <asp:BoundColumn DataField="alarmtempmin" HeaderText="alarmtempmin"></asp:BoundColumn>
                    <asp:BoundColumn DataField="alarmtempmax" HeaderText="alarmtempmax"></asp:BoundColumn>
                    <asp:TemplateColumn HeaderText="Alarm ON/OFF">
                        <ItemTemplate>
                        <asp:label runat=server><%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].DefaultView.[0].state") %></label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:CheckBox id=CheckBox1 runat="server" Checked='<%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].DefaultView.[0].state") %>'>
                            </asp:CheckBox>
                        </EditItemTemplate>
                    </asp:TemplateColumn>
                    <asp:BoundColumn DataField="state" SortExpression="state" HeaderText="Alarm ON?"></asp:BoundColumn>
                </Columns>
                <PagerStyle HorizontalAlign="Right" ForeColor="Black" BackColor="#C6C3C6"></PagerStyle>
            </asp:datagrid><asp:datagrid id=DataGrid2 style="Z-INDEX: 103; LEFT: 48px; POSITION: absolute; TOP: 280px" runat="server" Width="328px" Height="138px" GridLines="None" CellPadding="3" BackColor="White" CellSpacing="1" BorderWidth="2px" BorderStyle="Ridge" BorderColor="White" AutoGenerateColumns="False" DataSource="<%# myDataSetList1 %>" DataKeyField="tempsensorlogID">
                <FooterStyle ForeColor="Black" BackColor="#C6C3C6"></FooterStyle>
                <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#9471DE"></SelectedItemStyle>
                <ItemStyle ForeColor="Black" BackColor="#DEDFDE"></ItemStyle>
                <HeaderStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="#E7E7FF" VerticalAlign="Middle"
                    BackColor="#4A3C8C"></HeaderStyle>
                <Columns>
                    <asp:BoundColumn Visible="False" DataField="tempsensorlogID" HeaderText="tempsensorlogID"></asp:BoundColumn>
                    <asp:BoundColumn DataField="sensorname" SortExpression="sensorname" HeaderText="sensorname"></asp:BoundColumn>
                    <asp:BoundColumn DataField="temperature" SortExpression="temperature" HeaderText="temperature"></asp:BoundColumn>
                    <asp:BoundColumn DataField="timestamp" SortExpression="timestamp" HeaderText="timestamp"></asp:BoundColumn>
                </Columns>
                <PagerStyle HorizontalAlign="Right" ForeColor="Black" BackColor="#C6C3C6"></PagerStyle>
            </asp:datagrid><asp:datagrid id=DataGrid3 style="Z-INDEX: 105; LEFT: 648px; POSITION: absolute; TOP: 280px" runat="server" GridLines="Vertical" CellPadding="3" BackColor="White" BorderWidth="1px" BorderStyle="None" BorderColor="#999999" AutoGenerateColumns="False" DataSource="<%# myDataSetRelay1 %>" DataKeyField="relayID" DataMember="relay" HorizontalAlign="Center">
                <FooterStyle ForeColor="Black" BackColor="#CCCCCC"></FooterStyle>
                <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#008A8C"></SelectedItemStyle>
                <AlternatingItemStyle BackColor="#DCDCDC"></AlternatingItemStyle>
                <ItemStyle ForeColor="Black" BackColor="#EEEEEE"></ItemStyle>
                <HeaderStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="White" VerticalAlign="Middle"
                    BackColor="#000084"></HeaderStyle>
                <Columns>
                    <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
                    <asp:BoundColumn DataField="relayID" HeaderText="relayID"></asp:BoundColumn>
                    <asp:BoundColumn DataField="relayname" HeaderText="relayname"></asp:BoundColumn>
                    <asp:BoundColumn DataField="relaystate" HeaderText="relaystate"></asp:BoundColumn>
                </Columns>
                <PagerStyle HorizontalAlign="Center" ForeColor="Black" BackColor="#999999" Mode="NumericPages"></PagerStyle>
            </asp:datagrid></form>
    </body>
</HTML>
Avatar billede train Nybegynder
29. november 2005 - 12:26 #12
under alleomstændigheder skal du have point for det store arbejde du har lavet.

Jeg må dog erkende at det ikke virker, men kan kun tilskrive mig selv skylden, da jeg har tilføjet til den kode som du har kigget på, og derfor vil den ikke komme til at virke. Jeg kan detsvære ikke gennemskue hvad det er du har lavet, og kan derfor ikke implementere det :(  (troede det var 1-2 linjer der skulle tilføjes, og så var det det)

men smid et svar og du skal få point for det. 1000 tak for indsatsen
Avatar billede train Nybegynder
29. november 2005 - 12:30 #13
Dette er min nuværende kode, og piller ikke i den i tilfælde du skulle få overskud ;)


<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="jr.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
    <HEAD>
        <title>WebForm1</title>
        <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
        <meta content="C#" name="CODE_LANGUAGE">
        <meta content="JavaScript" name="vs_defaultClientScript">
        <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
        <form id="Form1" method="post" runat="server">
            <asp:label id="Label1" style="Z-INDEX: 101; LEFT: 424px; POSITION: absolute; TOP: 24px" runat="server"
                Width="88px" Height="32px"></asp:label><asp:button id="ButtonRefresh" style="Z-INDEX: 104; LEFT: 176px; POSITION: absolute; TOP: 16px"
                runat="server" Text="Refresh tempeture stats"></asp:button><asp:datagrid id=DataGrid1 style="Z-INDEX: 102; LEFT: 48px; POSITION: absolute; TOP: 64px" runat="server" Width="466px" Height="176px" GridLines="None" CellPadding="3" BackColor="White" CellSpacing="1" BorderWidth="2px" BorderStyle="Ridge" BorderColor="White" AutoGenerateColumns="False" DataSource="<%# myDataSet1 %>" DataKeyField="autoID" DataMember="tempsensor">
                <FooterStyle ForeColor="Black" BackColor="#C6C3C6"></FooterStyle>
                <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#9471DE"></SelectedItemStyle>
                <ItemStyle ForeColor="Black" BackColor="#DEDFDE"></ItemStyle>
                <HeaderStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="#E7E7FF" VerticalAlign="Middle"
                    BackColor="#4A3C8C"></HeaderStyle>
                <Columns>
                    <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
                    <asp:BoundColumn Visible="False" DataField="tempsensorID" SortExpression="tempsensorID" HeaderText="tempsensorID"></asp:BoundColumn>
                    <asp:BoundColumn DataField="sensorname" HeaderText="sensorname"></asp:BoundColumn>
                    <asp:BoundColumn DataField="alarmtempmin" HeaderText="alarmtempmin"></asp:BoundColumn>
                    <asp:BoundColumn DataField="alarmtempmax" HeaderText="alarmtempmax"></asp:BoundColumn>
                    <asp:TemplateColumn HeaderText="Alarm ON/OFF">
                        <ItemTemplate>
                            <asp:CheckBox id=CheckBox2 runat="server" Text='<%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].DefaultView.[0].state") %>' Enabled="False" Checked='<%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].DefaultView.[0].state") %>'>
                            </asp:CheckBox>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:CheckBox id=CheckBox1 runat="server" Checked='<%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].DefaultView.[0].state") %>'>
                            </asp:CheckBox>
                        </EditItemTemplate>
                    </asp:TemplateColumn>
                    <asp:BoundColumn DataField="state" SortExpression="state" HeaderText="Alarm ON?"></asp:BoundColumn>
                </Columns>
                <PagerStyle HorizontalAlign="Right" ForeColor="Black" BackColor="#C6C3C6"></PagerStyle>
            </asp:datagrid><asp:datagrid id=DataGrid2 style="Z-INDEX: 103; LEFT: 48px; POSITION: absolute; TOP: 272px" runat="server" Width="328px" Height="138px" GridLines="None" CellPadding="3" BackColor="White" CellSpacing="1" BorderWidth="2px" BorderStyle="Ridge" BorderColor="White" AutoGenerateColumns="False" DataSource="<%# myDataSetList1 %>" DataKeyField="tempsensorlogID">
                <FooterStyle ForeColor="Black" BackColor="#C6C3C6"></FooterStyle>
                <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#9471DE"></SelectedItemStyle>
                <ItemStyle ForeColor="Black" BackColor="#DEDFDE"></ItemStyle>
                <HeaderStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="#E7E7FF" VerticalAlign="Middle"
                    BackColor="#4A3C8C"></HeaderStyle>
                <Columns>
                    <asp:BoundColumn Visible="False" DataField="tempsensorlogID" HeaderText="tempsensorlogID"></asp:BoundColumn>
                    <asp:BoundColumn DataField="sensorname" SortExpression="sensorname" HeaderText="sensorname"></asp:BoundColumn>
                    <asp:BoundColumn DataField="temperature" SortExpression="temperature" HeaderText="temperature"></asp:BoundColumn>
                    <asp:BoundColumn DataField="timestamp" SortExpression="timestamp" HeaderText="timestamp"></asp:BoundColumn>
                </Columns>
                <PagerStyle HorizontalAlign="Right" ForeColor="Black" BackColor="#C6C3C6"></PagerStyle>
            </asp:datagrid>
            <asp:DataGrid id=DataGrid3 style="Z-INDEX: 105; LEFT: 392px; POSITION: absolute; TOP: 272px" runat="server" DataKeyField="relayID" DataSource="<%# myDataSetRelay1 %>" AutoGenerateColumns="False" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellSpacing="1" BackColor="White" CellPadding="3" GridLines="None">
                <FooterStyle ForeColor="Black" BackColor="#C6C3C6"></FooterStyle>
                <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#9471DE"></SelectedItemStyle>
                <ItemStyle ForeColor="Black" BackColor="#DEDFDE"></ItemStyle>
                <HeaderStyle Font-Bold="True" ForeColor="#E7E7FF" BackColor="#4A3C8C"></HeaderStyle>
                <Columns>
                    <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
                    <asp:BoundColumn Visible="False" DataField="relayID" HeaderText="relayID"></asp:BoundColumn>
                    <asp:BoundColumn DataField="relayname" HeaderText="relayname"></asp:BoundColumn>
                    <asp:BoundColumn DataField="relaystate" ReadOnly="True" HeaderText="relaystate"></asp:BoundColumn>
                </Columns>
                <PagerStyle HorizontalAlign="Right" ForeColor="Black" BackColor="#C6C3C6"></PagerStyle>
            </asp:DataGrid></form>
    </body>
</HTML>
Avatar billede dr_chaos Nybegynder
29. november 2005 - 12:32 #14
jeg prøver lige en sidste gang


Får du de rigtige true false værdier vist hvor checkboxen plejede at være ?
aspx fil:
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="jr.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
    <HEAD>
        <title>WebForm1</title>
        <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
        <meta content="C#" name="CODE_LANGUAGE">
        <meta content="JavaScript" name="vs_defaultClientScript">
        <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
        <form id="Form1" method="post" runat="server">
            <asp:label id="Label1" style="Z-INDEX: 101; LEFT: 424px; POSITION: absolute; TOP: 312px" runat="server"
                Width="88px" Height="32px"></asp:label><asp:button id="ButtonRefresh" style="Z-INDEX: 104; LEFT: 416px; POSITION: absolute; TOP: 376px"
                runat="server" Text="Refresh tempeture stats"></asp:button><asp:datagrid id=DataGrid1 style="Z-INDEX: 102; LEFT: 48px; POSITION: absolute; TOP: 64px" runat="server" Width="466px" Height="176px" GridLines="None" CellPadding="3" BackColor="White" CellSpacing="1" BorderWidth="2px" BorderStyle="Ridge" BorderColor="White" AutoGenerateColumns="False" DataSource="<%# myDataSet1 %>" DataKeyField="autoID" DataMember="tempsensor">
                <FooterStyle ForeColor="Black" BackColor="#C6C3C6"></FooterStyle>
                <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#9471DE"></SelectedItemStyle>
                <ItemStyle ForeColor="Black" BackColor="#DEDFDE"></ItemStyle>
                <HeaderStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="#E7E7FF" VerticalAlign="Middle"
                    BackColor="#4A3C8C"></HeaderStyle>
                <Columns>
                    <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
                    <asp:BoundColumn Visible="False" DataField="tempsensorID" SortExpression="tempsensorID" HeaderText="tempsensorID"></asp:BoundColumn>
                    <asp:BoundColumn DataField="sensorname" HeaderText="sensorname"></asp:BoundColumn>
                    <asp:BoundColumn DataField="alarmtempmin" HeaderText="alarmtempmin"></asp:BoundColumn>
                    <asp:BoundColumn DataField="alarmtempmax" HeaderText="alarmtempmax"></asp:BoundColumn>
                    <asp:TemplateColumn HeaderText="Alarm ON/OFF">
                        <ItemTemplate>
                        <asp:label runat=server><%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].DefaultView.[0].state") %></label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:CheckBox id=CheckBox1 runat="server" Checked='<%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].DefaultView.[0].state") %>'>
                            </asp:CheckBox>
                        </EditItemTemplate>
                    </asp:TemplateColumn>
                    <asp:BoundColumn DataField="state" SortExpression="state" HeaderText="Alarm ON?"></asp:BoundColumn>
                </Columns>
                <PagerStyle HorizontalAlign="Right" ForeColor="Black" BackColor="#C6C3C6"></PagerStyle>
            </asp:datagrid><asp:datagrid id=DataGrid2 style="Z-INDEX: 103; LEFT: 48px; POSITION: absolute; TOP: 280px" runat="server" Width="328px" Height="138px" GridLines="None" CellPadding="3" BackColor="White" CellSpacing="1" BorderWidth="2px" BorderStyle="Ridge" BorderColor="White" AutoGenerateColumns="False" DataSource="<%# myDataSetList1 %>" DataKeyField="tempsensorlogID">
                <FooterStyle ForeColor="Black" BackColor="#C6C3C6"></FooterStyle>
                <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#9471DE"></SelectedItemStyle>
                <ItemStyle ForeColor="Black" BackColor="#DEDFDE"></ItemStyle>
                <HeaderStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="#E7E7FF" VerticalAlign="Middle"
                    BackColor="#4A3C8C"></HeaderStyle>
                <Columns>
                    <asp:BoundColumn Visible="False" DataField="tempsensorlogID" HeaderText="tempsensorlogID"></asp:BoundColumn>
                    <asp:BoundColumn DataField="sensorname" SortExpression="sensorname" HeaderText="sensorname"></asp:BoundColumn>
                    <asp:BoundColumn DataField="temperature" SortExpression="temperature" HeaderText="temperature"></asp:BoundColumn>
                    <asp:BoundColumn DataField="timestamp" SortExpression="timestamp" HeaderText="timestamp"></asp:BoundColumn>
                </Columns>
                <PagerStyle HorizontalAlign="Right" ForeColor="Black" BackColor="#C6C3C6"></PagerStyle>
            </asp:datagrid><asp:datagrid id=DataGrid3 style="Z-INDEX: 105; LEFT: 648px; POSITION: absolute; TOP: 280px" runat="server" GridLines="Vertical" CellPadding="3" BackColor="White" BorderWidth="1px" BorderStyle="None" BorderColor="#999999" AutoGenerateColumns="False" DataSource="<%# myDataSetRelay1 %>" DataKeyField="relayID" DataMember="relay" HorizontalAlign="Center">
                <FooterStyle ForeColor="Black" BackColor="#CCCCCC"></FooterStyle>
                <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#008A8C"></SelectedItemStyle>
                <AlternatingItemStyle BackColor="#DCDCDC"></AlternatingItemStyle>
                <ItemStyle ForeColor="Black" BackColor="#EEEEEE"></ItemStyle>
                <HeaderStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="White" VerticalAlign="Middle"
                    BackColor="#000084"></HeaderStyle>
                <Columns>
                    <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
                    <asp:BoundColumn DataField="relayID" HeaderText="relayID"></asp:BoundColumn>
                    <asp:BoundColumn DataField="relayname" HeaderText="relayname"></asp:BoundColumn>
                    <asp:BoundColumn DataField="relaystate" HeaderText="relaystate"></asp:BoundColumn>
                </Columns>
                <PagerStyle HorizontalAlign="Center" ForeColor="Black" BackColor="#999999" Mode="NumericPages"></PagerStyle>
            </asp:datagrid></form>
    </body>
</HTML>
Avatar billede dr_chaos Nybegynder
29. november 2005 - 12:35 #15
cs:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;



               

namespace jr
{
    /// <summary>
    /// Summary description for WebForm1.
    /// </summary>
    public class WebForm1 : System.Web.UI.Page
    {
        protected System.Web.UI.WebControls.DataGrid DataGrid1;
        protected System.Web.UI.WebControls.Label Label1;
        protected System.Web.UI.WebControls.DataGrid DataGrid2;
        protected jr.myDataSet myDataSet1;
        protected System.Web.UI.WebControls.Button ButtonRefresh;
        protected Component1 myComponent = new Component1();
        protected jr.myDataSetList myDataSetList1;
        protected System.Web.UI.WebControls.DataGrid DataGrid3;
        protected jr.myDataSetRelay myDataSetRelay1;
/// </summary>
            private void Page_Load(object sender, System.EventArgs e)
        {
            myComponent.FillDataSet(myDataSet1);
            myComponent.FillDataSet(myDataSetList1);
            myComponent.FillDataSet(myDataSetRelay1);
           
            if (!IsPostBack)
            {
               
                DataGrid1.DataBind();
                DataGrid2.DataBind();
                DataGrid3.DataBind();
                Label1.DataBind();
               
            }

           
        }

        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }
       
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {   
            this.myDataSet1 = new jr.myDataSet();
            this.myDataSetList1 = new jr.myDataSetList();
            this.myDataSetRelay1 = new jr.myDataSetRelay();
            ((System.ComponentModel.ISupportInitialize)(this.myDataSet1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.myDataSetList1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.myDataSetRelay1)).BeginInit();
            this.ButtonRefresh.Click += new System.EventHandler(this.ButtonRefresh_Click);
            this.DataGrid1.CancelCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_CancelCommand);
            this.DataGrid1.EditCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_EditCommand);
            this.DataGrid1.UpdateCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_UpdateCommand);
            this.DataGrid1.SelectedIndexChanged += new System.EventHandler(this.DataGrid1_SelectedIndexChanged);
            this.DataGrid3.CancelCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid3_CancelCommand);
            this.DataGrid3.EditCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid3_EditCommand);
            this.DataGrid3.UpdateCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid3_UpdateCommand);
            this.DataGrid3.SelectedIndexChanged += new System.EventHandler(this.DataGrid3_SelectedIndexChanged);
            //
            // myDataSet1
            //
            this.myDataSet1.DataSetName = "myDataSet";
            this.myDataSet1.Locale = new System.Globalization.CultureInfo("da-DK");
            //
            // myDataSetList1
            //
            this.myDataSetList1.DataSetName = "myDataSetList";
            this.myDataSetList1.Locale = new System.Globalization.CultureInfo("da-DK");
            //
            // myDataSetRelay1
            //
            this.myDataSetRelay1.DataSetName = "myDataSetRelay";
            this.myDataSetRelay1.Locale = new System.Globalization.CultureInfo("da-DK");
            this.Load += new System.EventHandler(this.Page_Load);
            ((System.ComponentModel.ISupportInitialize)(this.myDataSet1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.myDataSetList1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.myDataSetRelay1)).EndInit();

        }
        #endregion

        private void DataGrid1_SelectedIndexChanged(object sender, System.EventArgs e)
        {
       
        }

        private void DataGrid1_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            DataGrid1.EditItemIndex = e.Item.ItemIndex;
            DataGrid1.DataBind();
           
        }

        private void DataGrid1_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            DataGrid1.EditItemIndex = -1;
            DataGrid1.DataBind();
        }

       
        private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
           
            int celle = 0;
            try
            {
                int alarmtempmin, alarmtempmax;
                int temp;
                string sensorname;
                bool state;

                // Gets the value of the key field of the row being updated
                string key = DataGrid1.DataKeys[e.Item.ItemIndex].ToString();
               

                // Gets get the value of the controls (textboxes) that the user
                // updated. The DataGrid columns are exposed as the Cells collection.
                // Each cell has a collection of controls. In this case, there is only one
                // control in each cell -- a TextBox control. To get its value,
                // you copy the TextBox to a local instance (which requires casting)
                // and extract its Text property.
                //
                // The first column -- Cells(0) -- contains the Update and Cancel buttons.
                TextBox tb;
              //  CheckBox cb;
                // Gets the value the TextBox control in the third column
               
                tb = (TextBox)(e.Item.Cells[3].Controls[0]);
                temp= int.Parse(tb.Text);
                if(temp<=125 && temp >=-55)
                    alarmtempmin = Convert.ToInt16(tb.Text);
                else
                    {
                        throw(new FormatException(""));
                    }
                tb.BackColor = Color.White;
                celle++;

                // Gets the value the TextBox control in the fourth column
                tb = (TextBox)(e.Item.Cells[4].Controls[0]);
                temp= int.Parse(tb.Text);
               
                if(temp<=125 && temp >=-55)
                    alarmtempmax = Convert.ToInt16(tb.Text);
                else
                {
                    throw(new FormatException(""));
                }
                tb.BackColor = Color.White;
                celle++;
           
                // Gets the value the TextBox control in the fifth column
                tb = (TextBox)(e.Item.Cells[2].Controls[0]);
                sensorname = tb.Text;
                tb.BackColor = Color.White;
               
                // Gets the value the CheckBox control in the sixth colum
          /*      cb = (CheckBox)(e.Item.Cells[5].Controls[1]);
                if (cb.Checked)
                    state = true;
                else
                    state = false;
                */
                // Finds the row in the dataset table that matches the
                // one the user updated in the grid. This example uses a
                // special Find method defined for the typed dataset, which
                // returns a reference to the row.
                myDataSet.tempsensorRow r;
                r = myDataSet1.tempsensor.FindByautoID(int.Parse(key));

                // Updates the dataset table.
                r.alarmtempmin = alarmtempmin;
                r.alarmtempmax = alarmtempmax;
                r.sensorname = sensorname;
                r.state = state;

                // Calls a SQL statement to update the database from the dataset
                jr.Component1 myComponent = new Component1();
                myComponent.sqlDataAdapter1.Update(myDataSet1);

           
                // Takes the DataGrid row out of editing mode
                DataGrid1.EditItemIndex = -1;
              //  ((CheckBox)(e.Item.Cells[5].Controls[1])).Checked = state;
               
                // Refreshes the grid
                DataGrid1.DataBind();
                DataGrid2.DataBind();
               
               
                // reset catch cell counter
                celle = 0;
            }
            catch (FormatException)
            {
                TextBox tb;
                tb = (TextBox)(e.Item.Cells[celle+3].Controls[0]);
                tb.BackColor=Color.Red;
                tb.Text ="Wrong value";
                                                       
            }
           
            // Prøver at opdatere Datagrid2 efter endt update - virker ikke hver gang
            DataGrid2.DataBind();
           
           
        }

        private void ButtonRefresh_Click(object sender, System.EventArgs e)
        {
            DataGrid2.DataBind();
        }
        private void DataGrid3_SelectedIndexChanged(object sender, System.EventArgs e)
        {
       
        }

        private void DataGrid3_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            DataGrid3.EditItemIndex = e.Item.ItemIndex;
            DataGrid3.DataBind();

        }

        private void DataGrid3_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            DataGrid3.EditItemIndex = -1;
            DataGrid3.DataBind();

        }
       
        private void DataGrid3_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            int celle = 0;
            try
            {
               
                string relayname;
//                bool relaystate;

                // Gets the value of the key field of the row being updated
                string key = DataGrid3.DataKeys[e.Item.ItemIndex].ToString();
                           

                // Gets get the value of the controls (textboxes) that the user
                // updated. The DataGrid columns are exposed as the Cells collection.
                // Each cell has a collection of controls. In this case, there is only one
                // control in each cell -- a TextBox control. To get its value,
                // you copy the TextBox to a local instance (which requires casting)
                // and extract its Text property.
                //
                // The first column -- Cells(0) -- contains the Update and Cancel buttons.
                TextBox tb;
//                CheckBox cb;
                // Gets the value the TextBox control in the third column
               
        /*        tb = (TextBox)(e.Item.Cells[3].Controls[0]);
                temp= int.Parse(tb.Text);
                if(temp<=125 && temp >=-55)
                    alarmtempmin = Convert.ToInt16(tb.Text);
                else
                {
                    throw(new FormatException(""));
                }
                tb.BackColor = Color.White;
                celle++;

                // Gets the value the TextBox control in the fourth column
                tb = (TextBox)(e.Item.Cells[4].Controls[0]);
                temp= int.Parse(tb.Text);
               
                if(temp<=125 && temp >=-55)
                    alarmtempmax = Convert.ToInt16(tb.Text);
                else
                {
                    throw(new FormatException(""));
                }
                tb.BackColor = Color.White;
                celle++;
                /*alarmtempmax = Convert.ToInt16(tb.Text);
                tb.BackColor = Color.White;
                celle++;
*/
                // Gets the value the TextBox control in the fifth column
                tb = (TextBox)(e.Item.Cells[2].Controls[0]);
                relayname = tb.Text;
                tb.BackColor = Color.Red;
               
               
                // Gets the value the CheckBox control in the sixth colum
/*                cb = (CheckBox)(e.Item.Cells[5].Controls[1]);
                if (cb.Checked)
                    state = true;
                else
                    state = false;
    */           
                // Finds the row in the dataset table that matches the
                // one the user updated in the grid. This example uses a
                // special Find method defined for the typed dataset, which
                // returns a reference to the row.
                myDataSetRelay.relayRow r;
                r = myDataSetRelay1.relay.FindByrelayID(int.Parse(key));

               

                // Updates the dataset table.
    //            r.alarmtempmin = alarmtempmin;
    //            r.alarmtempmax = alarmtempmax;
                r.relayname = relayname;
    //            r.relaystate = relaystate;

                // Calls a SQL statement to update the database from the dataset
                jr.Component1 myComponent = new Component1();
                myComponent.sqlDataAdapter3.Update(myDataSetRelay1);

                // Takes the DataGrid row out of editing mode
                DataGrid3.EditItemIndex = -1;
            //    ((CheckBox)(e.Item.Cells[5].Controls[1])).Checked = relaystate;
               
                // Refreshes the grid
                DataGrid3.DataBind();
               
                // reset catch cell counter
                celle = 0;
            }
            catch (FormatException)
            {
                TextBox tb;
                tb = (TextBox)(e.Item.Cells[celle+2].Controls[0]);
                tb.BackColor=Color.Red;
                tb.Text ="Wrong value";
                                                       
            }
           
            // Prøver at opdatere Datagrid2 efter endt update - virker ikke hver gang
            DataGrid3.DataBind();
           
           
        }

       
    }
}
Avatar billede dr_chaos Nybegynder
29. november 2005 - 12:35 #16
får du nu vist true false der hvor check boxen var ?
Avatar billede dr_chaos Nybegynder
29. november 2005 - 12:36 #17
smider da lige et svar :)
Avatar billede train Nybegynder
29. november 2005 - 13:01 #18
får den her fejl

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Unexpected end of file looking for </asp:label> tag.

Source Error:


Line 27:                    <asp:TemplateColumn HeaderText="Alarm ON/OFF">
Line 28:                        <ItemTemplate>
Line 29:                        <asp:label runat=server ID="Labe12" NAME="Labe12"><%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].DefaultView.[0].state") %></label>
Line 30:                        </ItemTemplate>
Line 31:                        <EditItemTemplate>
Avatar billede dr_chaos Nybegynder
29. november 2005 - 13:03 #19
ret <asp:label runat=server><%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].DefaultView.[0].state") %></label>

til

<asp:label runat=server><%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].DefaultView.[0].state") %></asp:label>
Avatar billede train Nybegynder
29. november 2005 - 13:38 #20
nu er den helt gal  . compilere fint og kommer på fint op - men min checkbox viser stadig kun den første værdi og "viser" den værdi som resten af den kolonne som den første værdi, dog nu kan jeg ikke rette i DB'en fra min checkbox længere.
Avatar billede dr_chaos Nybegynder
29. november 2005 - 13:44 #21
jeg skal lige høre state hvad er det ?
Avatar billede dr_chaos Nybegynder
29. november 2005 - 13:44 #22
er det en værdi fra db ?
Avatar billede train Nybegynder
29. november 2005 - 14:33 #23
ja stats er en værdi i min db  ( med værdien 0 eller 1)
Avatar billede dr_chaos Nybegynder
29. november 2005 - 14:40 #24
prøv med :
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="jr.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
    <HEAD>
        <title>WebForm1</title>
        <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
        <meta content="C#" name="CODE_LANGUAGE">
        <meta content="JavaScript" name="vs_defaultClientScript">
        <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
        <form id="Form1" method="post" runat="server">
            <asp:label id="Label1" style="Z-INDEX: 101; LEFT: 424px; POSITION: absolute; TOP: 312px" runat="server"
                Width="88px" Height="32px"></asp:label><asp:button id="ButtonRefresh" style="Z-INDEX: 104; LEFT: 416px; POSITION: absolute; TOP: 376px"
                runat="server" Text="Refresh tempeture stats"></asp:button><asp:datagrid id=DataGrid1 style="Z-INDEX: 102; LEFT: 48px; POSITION: absolute; TOP: 64px" runat="server" Width="466px" Height="176px" GridLines="None" CellPadding="3" BackColor="White" CellSpacing="1" BorderWidth="2px" BorderStyle="Ridge" BorderColor="White" AutoGenerateColumns="False" DataSource="<%# myDataSet1 %>" DataKeyField="autoID" DataMember="tempsensor">
                <FooterStyle ForeColor="Black" BackColor="#C6C3C6"></FooterStyle>
                <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#9471DE"></SelectedItemStyle>
                <ItemStyle ForeColor="Black" BackColor="#DEDFDE"></ItemStyle>
                <HeaderStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="#E7E7FF" VerticalAlign="Middle"
                    BackColor="#4A3C8C"></HeaderStyle>
                <Columns>
                    <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
                    <asp:BoundColumn Visible="False" DataField="tempsensorID" SortExpression="tempsensorID" HeaderText="tempsensorID"></asp:BoundColumn>
                    <asp:BoundColumn DataField="sensorname" HeaderText="sensorname"></asp:BoundColumn>
                    <asp:BoundColumn DataField="alarmtempmin" HeaderText="alarmtempmin"></asp:BoundColumn>
                    <asp:BoundColumn DataField="alarmtempmax" HeaderText="alarmtempmax"></asp:BoundColumn>
                    <asp:TemplateColumn HeaderText="Alarm ON/OFF">
                        <ItemTemplate>
                            <asp:CheckBox id=CheckBox2 runat="server" Text='<%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].DefaultView.state") %>' Checked='<%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].DefaultView.state") %>' Enabled="False">
                            </asp:CheckBox>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:CheckBox id=CheckBox1 runat="server" Checked='<%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].DefaultView.state") %>'>
                            </asp:CheckBox>
                        </EditItemTemplate>
                    </asp:TemplateColumn>
                    <asp:BoundColumn DataField="state" SortExpression="state" HeaderText="Alarm ON?"></asp:BoundColumn>
                </Columns>
                <PagerStyle HorizontalAlign="Right" ForeColor="Black" BackColor="#C6C3C6"></PagerStyle>
            </asp:datagrid><asp:datagrid id=DataGrid2 style="Z-INDEX: 103; LEFT: 48px; POSITION: absolute; TOP: 280px" runat="server" Width="328px" Height="138px" GridLines="None" CellPadding="3" BackColor="White" CellSpacing="1" BorderWidth="2px" BorderStyle="Ridge" BorderColor="White" AutoGenerateColumns="False" DataSource="<%# myDataSetList1 %>" DataKeyField="tempsensorlogID">
                <FooterStyle ForeColor="Black" BackColor="#C6C3C6"></FooterStyle>
                <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#9471DE"></SelectedItemStyle>
                <ItemStyle ForeColor="Black" BackColor="#DEDFDE"></ItemStyle>
                <HeaderStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="#E7E7FF" VerticalAlign="Middle"
                    BackColor="#4A3C8C"></HeaderStyle>
                <Columns>
                    <asp:BoundColumn Visible="False" DataField="tempsensorlogID" HeaderText="tempsensorlogID"></asp:BoundColumn>
                    <asp:BoundColumn DataField="sensorname" SortExpression="sensorname" HeaderText="sensorname"></asp:BoundColumn>
                    <asp:BoundColumn DataField="temperature" SortExpression="temperature" HeaderText="temperature"></asp:BoundColumn>
                    <asp:BoundColumn DataField="timestamp" SortExpression="timestamp" HeaderText="timestamp"></asp:BoundColumn>
                </Columns>
                <PagerStyle HorizontalAlign="Right" ForeColor="Black" BackColor="#C6C3C6"></PagerStyle>
            </asp:datagrid><asp:datagrid id=DataGrid3 style="Z-INDEX: 105; LEFT: 648px; POSITION: absolute; TOP: 280px" runat="server" GridLines="Vertical" CellPadding="3" BackColor="White" BorderWidth="1px" BorderStyle="None" BorderColor="#999999" AutoGenerateColumns="False" DataSource="<%# myDataSetRelay1 %>" DataKeyField="relayID" DataMember="relay" HorizontalAlign="Center">
                <FooterStyle ForeColor="Black" BackColor="#CCCCCC"></FooterStyle>
                <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#008A8C"></SelectedItemStyle>
                <AlternatingItemStyle BackColor="#DCDCDC"></AlternatingItemStyle>
                <ItemStyle ForeColor="Black" BackColor="#EEEEEE"></ItemStyle>
                <HeaderStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="White" VerticalAlign="Middle"
                    BackColor="#000084"></HeaderStyle>
                <Columns>
                    <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
                    <asp:BoundColumn DataField="relayID" HeaderText="relayID"></asp:BoundColumn>
                    <asp:BoundColumn DataField="relayname" HeaderText="relayname"></asp:BoundColumn>
                    <asp:BoundColumn DataField="relaystate" HeaderText="relaystate"></asp:BoundColumn>
                </Columns>
                <PagerStyle HorizontalAlign="Center" ForeColor="Black" BackColor="#999999" Mode="NumericPages"></PagerStyle>
            </asp:datagrid></form>
    </body>
</HTML>
Avatar billede dr_chaos Nybegynder
29. november 2005 - 14:41 #25
giv mig besked om evt fejl eller hvordan det ser ud.
jeg har rettet
Tables[tempsensor].DefaultView.[0].state
til
Tables[tempsensor].DefaultView.state
Avatar billede train Nybegynder
29. november 2005 - 14:50 #26
DataBinder.Eval: 'System.Data.DataView' does not contain a property with the name state.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: DataBinder.Eval: 'System.Data.DataView' does not contain a property with the name state.

Source Error:


Line 27:                    <asp:TemplateColumn HeaderText="Alarm ON/OFF">
Line 28:                        <ItemTemplate>
Line 29:                            <asp:CheckBox id=CheckBox2 runat="server" Text='<%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].DefaultView.state") %>' Checked='<%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].DefaultView.state") %>' Enabled="False">
Line 30:                            </asp:CheckBox>
Line 31:                        </ItemTemplate>


Source File: c:\inetpub\wwwroot\jr\WebForm1.aspx    Line: 29
Avatar billede dr_chaos Nybegynder
29. november 2005 - 14:54 #27
prøv at rette
<ItemTemplate>
                            <asp:CheckBox id=CheckBox2 runat="server" Text='<%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].DefaultView.state") %>' Checked='<%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].DefaultView.state") %>' Enabled="False">
                            </asp:CheckBox>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:CheckBox id=CheckBox1 runat="server" Checked='<%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].DefaultView.state") %>'>
                            </asp:CheckBox>
                        </EditItemTemplate>

til

<ItemTemplate>
                            <asp:CheckBox id=CheckBox2 runat="server" Text='<%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].Columns[state]") %>' Checked='<%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].Columns[state]") %>' Enabled="False">
                            </asp:CheckBox>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:CheckBox id=CheckBox1 runat="server" Checked='<%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].Columns[state]") %>'>
                            </asp:CheckBox>
                        </EditItemTemplate>
Avatar billede train Nybegynder
29. november 2005 - 15:54 #28
Jeg tager hatten af for dit gå på mod, og det er virkelig værsat, da jeg skal have det her til at virke inden ugens udgang (del i et eksamensprojekt)

Specified cast is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Specified cast is not valid.

Source Error:


Line 27:                    <asp:TemplateColumn HeaderText="Alarm ON/OFF">
Line 28:                        <ItemTemplate>
Line 29:                            <asp:CheckBox id=CheckBox2 runat="server" Text='<%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].Columns[state]") %>' Checked='<%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].Columns[state]") %>' Enabled="False">
Line 30:                            </asp:CheckBox>
Line 31:                        </ItemTemplate>


Source File: c:\inetpub\wwwroot\jr\WebForm1.aspx    Line: 29
Avatar billede dr_chaos Nybegynder
29. november 2005 - 17:21 #29
det er et fremskridt.
prøv lige at bruge
<ItemTemplate>
                            <asp:CheckBox id=CheckBox2 runat="server" Text='<%# DataBinder.Eval(myDataSet1, "Tables[tempsensor].Columns[state]") %>'  Enabled="False">
                            </asp:CheckBox>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:CheckBox id=CheckBox1 runat="server"
                            </asp:CheckBox>
                        </EditItemTemplate>
Avatar billede dr_chaos Nybegynder
29. november 2005 - 17:21 #30
det skulle meget gerne bare vise værdien af state som en tekst
Avatar billede train Nybegynder
29. november 2005 - 21:23 #31
det vil jeg prøve som det første i morgen tidlig. (skulle hjem og fejre min datters 3års fødselsdag ;) )
Avatar billede dr_chaos Nybegynder
29. november 2005 - 22:02 #32
familien er vigtig har selv en lille datter på snart 9 måneder der er ved at få tænder :)
Avatar billede train Nybegynder
30. november 2005 - 09:26 #33
helt sikkert, intet der overgår de små derhjemme :)  (har en mere på vej)

det ser ud til at gå den rigtige vej: 

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The server tag is not well formed.

Source Error:


Line 31:                        </ItemTemplate>
Line 32:                        <EditItemTemplate>
Line 33:                            <asp:CheckBox id=CheckBox1 runat="server"
Line 34:                            </asp:CheckBox>
Line 35:                        </EditItemTemplate>


Source File: c:\inetpub\wwwroot\jr\WebForm1.aspx    Line: 33
Avatar billede dr_chaos Nybegynder
30. november 2005 - 13:42 #34
ændre  <asp:CheckBox id=CheckBox1 runat="server"
                  </asp:CheckBox>

til

<asp:CheckBox id=CheckBox1 runat="server">
                  </asp:CheckBox>
Avatar billede train Nybegynder
30. november 2005 - 18:22 #35
perfekt !!!!  - ikke meget andet at sige til det :D
Avatar billede train Nybegynder
30. november 2005 - 18:23 #36
nok engang , mange tak for den store hjælp.
Avatar billede dr_chaos Nybegynder
30. november 2005 - 18:55 #37
har du fået checkboxene til at virke ?
Avatar billede train Nybegynder
30. november 2005 - 19:11 #38
jup, der var lig et par småting , men havde en hjælpende hånd til lige at få det sidste på plads, takket være dit forarbejde.
Avatar billede dr_chaos Nybegynder
30. november 2005 - 19:14 #39
perfekt så har jeg "fortjent " de 200 points :)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
IT-kurser om Microsoft 365, sikkerhed, personlig vækst, udvikling, digital markedsføring, grafisk design, SAP og forretningsanalyse.

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester