|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DataGrid not responding to Update/Cancel clickI have a datagrid which when I click on the Edit button puts the grid into the editable mode and changes the text property of a label to 'Edit'. However when I click on the Update or Cancel buttons that have appreared on the Editing row there associated events are not called. I know they are not being called because I have coded it so the text property of the label changes to signal this. I have declared the event handlers like so :- this.DataGrid1.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_ItemCommand); this.DataGrid1.EditCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_EditCommand); this.DataGrid1.CancelCommand += new DataGridCommandEventHandler(this.DataGrid1_CancelCommand); this.DataGrid1.UpdateCommand += new DataGridCommandEventHandler(DataGrid1_UpdateCommand); And the command handlers like so :- private void DataGrid1_EditCommand(object source, DataGridCommandEventArgs e) { //this works fine - gets called this.lblError.Text = "Edit"; this.DataGrid1.EditItemIndex = (int)e.Item.ItemIndex; this.lblError.Text = "Edit"; this.bindGrid(); this.lblError.Text = "Edit"; } public void DataGrid1_CancelCommand(object source, DataGridCommandEventArgs e) { //doesnt work - no call label does not change //grid does not exit editing mode this.lblError.Text = "Cancel"; this.DataGrid1.EditItemIndex = -1; bindGrid(); this.lblError.Text = "Cancel"; } private void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs e) { //purely here for debugging if (e.CommandName == "Cancel") { this.lblError.Text = "Cancel"; } } private void DataGrid1_UpdateCommand(object source, DataGridCommandEventArgs e) { //also does not work this.lblError.Text = "Update"; this.DataGrid1.EditItemIndex = -1; //bindGrid(); this.lblError.Text = "Update"; } Am I missing something? I have been looking at for the last couple of days now with no joy. What makes it even more frustrating is that in a previous similar project I had this working but I have been unable to adapt the code to this project. Any help would be appreciated. hi,
I faced the same thing . I dont know if this works but u can try this out: 1> make sure to enable viewstate true. 2> strange Visual studio 2003 problem . just remove the Event handlers from init event and also from designer properties( datagrid properties page will show events in designer where u can attach event handlers ) just remove the old ones u declared and double click next to the cancel and update command events in designer properties. the handlers will automatically be created in aspx.cs codebehind file). 3> copy the code for cancel and update events u had written earlier to the new handlers created . reply if this had solved the problem. bye NS andrew.robe***@poundland.co.uk wrote: Show quoteHide quote > Hope someone can help with this, its starting to send me over the edge! > > I have a datagrid which when I click on the Edit button puts the grid > into the editable mode and changes the text property of a label to > 'Edit'. However when I click on the Update or Cancel buttons that have > appreared on the Editing row there associated events are not called. I > know they are not being called because I have coded it so the text > property of the label changes to signal this. I have declared the event > handlers like so :- > > this.DataGrid1.ItemCommand += new > System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_ItemCommand); > this.DataGrid1.EditCommand += new > System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_EditCommand); > this.DataGrid1.CancelCommand += new > DataGridCommandEventHandler(this.DataGrid1_CancelCommand); > this.DataGrid1.UpdateCommand += new > DataGridCommandEventHandler(DataGrid1_UpdateCommand); > > And the command handlers like so :- > > private void DataGrid1_EditCommand(object source, > DataGridCommandEventArgs e) > { > //this works fine - gets called > this.lblError.Text = > "Edit"; > this.DataGrid1.EditItemIndex = (int)e.Item.ItemIndex; > this.lblError.Text = "Edit"; > this.bindGrid(); > this.lblError.Text = "Edit"; > > } > > public void DataGrid1_CancelCommand(object source, > DataGridCommandEventArgs e) > { > //doesnt work - no call label does not change > //grid does not exit > editing mode > this.lblError.Text = > "Cancel"; > this.DataGrid1.EditItemIndex = -1; > bindGrid(); > this.lblError.Text = "Cancel"; > } > > private void DataGrid1_ItemCommand(object source, > DataGridCommandEventArgs e) > { > //purely here for debugging > if (e.CommandName == > "Cancel") > { > this.lblError.Text = "Cancel"; > } > } > > private void DataGrid1_UpdateCommand(object source, > DataGridCommandEventArgs e) > { > //also does not work > this.lblError.Text = > "Update"; > this.DataGrid1.EditItemIndex = -1; > //bindGrid(); > this.lblError.Text = "Update"; > } > > Am I missing something? I have been looking at for the last couple of > days now with no joy. What makes it even more frustrating is that in a > previous similar project I had this working but I have been unable to > adapt the code to this project. > > Any help would be appreciated. > Hello,
Please let me know if its not the VS2003 .net but some human error (coding mistakes) ?? bye andrew.robe***@poundland.co.uk wrote: Show quoteHide quote > Hope someone can help with this, its starting to send me over the edge! > > I have a datagrid which when I click on the Edit button puts the grid > into the editable mode and changes the text property of a label to > 'Edit'. However when I click on the Update or Cancel buttons that have > appreared on the Editing row there associated events are not called. I > know they are not being called because I have coded it so the text > property of the label changes to signal this. I have declared the event > handlers like so :- > > this.DataGrid1.ItemCommand += new > System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_ItemCommand); > this.DataGrid1.EditCommand += new > System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_EditCommand); > this.DataGrid1.CancelCommand += new > DataGridCommandEventHandler(this.DataGrid1_CancelCommand); > this.DataGrid1.UpdateCommand += new > DataGridCommandEventHandler(DataGrid1_UpdateCommand); > > And the command handlers like so :- > > private void DataGrid1_EditCommand(object source, > DataGridCommandEventArgs e) > { > //this works fine - gets called > this.lblError.Text = > "Edit"; > this.DataGrid1.EditItemIndex = (int)e.Item.ItemIndex; > this.lblError.Text = "Edit"; > this.bindGrid(); > this.lblError.Text = "Edit"; > > } > > public void DataGrid1_CancelCommand(object source, > DataGridCommandEventArgs e) > { > //doesnt work - no call label does not change > //grid does not exit > editing mode > this.lblError.Text = > "Cancel"; > this.DataGrid1.EditItemIndex = -1; > bindGrid(); > this.lblError.Text = "Cancel"; > } > > private void DataGrid1_ItemCommand(object source, > DataGridCommandEventArgs e) > { > //purely here for debugging > if (e.CommandName == > "Cancel") > { > this.lblError.Text = "Cancel"; > } > } > > private void DataGrid1_UpdateCommand(object source, > DataGridCommandEventArgs e) > { > //also does not work > this.lblError.Text = > "Update"; > this.DataGrid1.EditItemIndex = -1; > //bindGrid(); > this.lblError.Text = "Update"; > } > > Am I missing something? I have been looking at for the last couple of > days now with no joy. What makes it even more frustrating is that in a > previous similar project I had this working but I have been unable to > adapt the code to this project. > > Any help would be appreciated. > Thanks for replying it is most appreciated. I posted the same question
on another forum (wont mention the name) and got squat! I tried your suggesstion but it still doesn't work. I have posted the entire code from the aspx and cs files, if you dont mind taking a look. You might see what I have done wrong. Thanks again. C# code 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 DataGridTest { /// <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 lblError; protected System.Data.DataTable datatbl; private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here if (!Page.IsPostBack) { this.bindGrid(); } } private void onPageOpen() { //dbc(); createTable(); getData(); } private void dbc() { } private void createTable() { this.datatbl = new DataTable(); this.datatbl.Columns.Add(new DataColumn("SKU", System.Type.GetType("System.Int32"))); this.datatbl.Columns.Add(new DataColumn("Description", typeof(string))); this.datatbl.Columns.Add(new DataColumn("Grade", typeof(string))); } private void getData() { if (Cache["table"] != null) { this.datatbl.Clear(); Cache.Remove("table"); } DataRow row; row = this.datatbl.NewRow(); row[0] = "1234"; row[1] = "Test"; row[2] = "Test"; this.datatbl.Rows.Add(row); Cache.Insert("table", this.datatbl); bindGrid(); } private void bindGrid() { this.DataGrid1.DataSource = (DataTable)Cache["table"]; this.DataGrid1.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. /// onPageOpen(); /// </summary> private void InitializeComponent() { 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.Load += new System.EventHandler(this.Page_Load); onPageOpen(); } #endregion private void DataGrid1_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { this.lblError.Text = "Edit"; this.DataGrid1.EditItemIndex = (int)e.Item.ItemIndex; this.lblError.Text = "Edit"; this.bindGrid(); this.lblError.Text = "Edit"; } private void DataGrid1_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { this.lblError.Text = "Cancel"; this.DataGrid1.EditItemIndex = -1; bindGrid(); this.lblError.Text = "Cancel"; } private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { this.lblError.Text = "Update"; this.DataGrid1.EditItemIndex = -1; bindGrid(); this.lblError.Text = "Update"; } } } HTML <%@ Page language="c#" Codebehind="default.aspx.cs" AutoEventWireup="false" Inherits="DataGridTest.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:datagrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 24px; POSITION: absolute; TOP: 32px" runat="server" AutoGenerateColumns="False" DataKeyField="SKU"> <Columns> <asp:ButtonColumn Text="Select" CommandName="Select"></asp:ButtonColumn> <asp:BoundColumn DataField="SKU" ReadOnly="True" HeaderText="SKU"></asp:BoundColumn> <asp:BoundColumn DataField="Description" HeaderText="Description"></asp:BoundColumn> <asp:BoundColumn DataField="Grade" HeaderText="Grade"></asp:BoundColumn> <asp:EditCommandColumn HeaderText="Edit" EditText="Edit" CancelText="Cancel" UpdateText="Update" ButtonType="LinkButton"></asp:EditCommandColumn> </Columns> </asp:datagrid><asp:label id="lblError" style="Z-INDEX: 102; LEFT: 360px; POSITION: absolute; TOP: 536px" runat="server" Width="376px" Height="32px">g</asp:label></form> </body> </HTML> Hi,
Rule 1. Copy/Paste is good but see that the code behind page file default.aspx.cs has a public class named _default ("_default" bcoz default is keyword in c#). This file must have all the event handling code and other things... The asp.net initializes components from a public code behind class that has the same name as the ASPX page. The code behind class code that u have provided derives from WebForm and not from _default class. (This is something to think about). Probably u have copy/pasted the code from WebForm1.aspx.cs file to the default.aspx.cs. I took away the onPageOpen() from initialize component.. just called the other 2 functions in Page_load() instead (not necessary to code this way though). c the code for changes and it 'll work fine: 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; namespace test { /// <summary> /// Summary description for _default. /// </summary> public class _default : System.Web.UI.Page { protected System.Web.UI.WebControls.DataGrid DataGrid1; protected System.Web.UI.WebControls.Label lblError; protected System.Data.DataTable datatbl; private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here if (!Page.IsPostBack) { createTable(); getData(); this.bindGrid(); } } private void onPageOpen() { //dbc(); createTable(); getData(); } private void dbc() { } private void createTable() { this.datatbl = new DataTable(); this.datatbl.Columns.Add(new DataColumn("SKU", System.Type.GetType("System.Int32"))); this.datatbl.Columns.Add(new DataColumn("Description", typeof(string))); this.datatbl.Columns.Add(new DataColumn("Grade", typeof(string))); } private void getData() { if (Cache["table"] != null) { this.datatbl.Clear(); Cache.Remove("table"); } DataRow row; row = this.datatbl.NewRow(); row["SKU"] = 1234; row["Description"] = "Test"; row["Grade"] = "Test"; this.datatbl.Rows.Add(row); Cache.Insert("table", this.datatbl); bindGrid(); } private void bindGrid() { this.DataGrid1.DataSource = (DataTable)Cache["table"]; this.DataGrid1.DataBind(); } private void DataGrid1_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { this.lblError.Text = "Edit"; this.DataGrid1.EditItemIndex = (int)e.Item.ItemIndex; this.lblError.Text = "Edit"; this.bindGrid(); this.lblError.Text = "Edit"; } private void DataGrid1_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { this.lblError.Text = "Cancel"; this.DataGrid1.EditItemIndex = -1; bindGrid(); this.lblError.Text = "Cancel"; } private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { this.lblError.Text = "Update"; this.DataGrid1.EditItemIndex = -1; bindGrid(); this.lblError.Text = "Update"; } #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.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.Load += new System.EventHandler(this.Page_Load); } #endregion } } //////////////// default.aspx Page ////////// <%@ Page language="c#" Codebehind="default.aspx.cs" AutoEventWireup="false" Inherits="test._default" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>default</title> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body MS_POSITIONING="GridLayout"> <form id="Form1" method="post" runat="server"> <asp:DataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" runat="server" Height="288px" Width="480px" AutoGenerateColumns="False"> <Columns> <asp:BoundColumn DataField="SKU" HeaderText="SKU"></asp:BoundColumn> <asp:BoundColumn DataField="Description" HeaderText="Description"></asp:BoundColumn> <asp:BoundColumn DataField="Grade" HeaderText="Grade"></asp:BoundColumn> <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" HeaderText="edit" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn> </Columns> </asp:DataGrid> <asp:Label id="lblError" style="Z-INDEX: 102; LEFT: 192px; POSITION: absolute; TOP: 368px" runat="server" Width="160px">Label</asp:Label> </form> </body> </HTML> ////////////////////////// End ASPX Page //////////////////////// andrew.robe***@poundland.co.uk wrote: Show quoteHide quote > Thanks for replying it is most appreciated. I posted the same question > on another forum (wont mention the name) and got squat! > > I tried your suggesstion but it still doesn't work. I have posted the > entire code from the aspx and cs files, if you dont mind taking a look. > You might see what I have done wrong. > > Thanks again. > > C# code > 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 DataGridTest > { > /// <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 lblError; > > protected System.Data.DataTable datatbl; > > private void Page_Load(object sender, System.EventArgs e) > { > // Put user code to initialize the page here > if (!Page.IsPostBack) > { > this.bindGrid(); > } > } > > private void onPageOpen() > { > //dbc(); > createTable(); > getData(); > } > > private void dbc() > { > > } > > private void createTable() > { > this.datatbl = new DataTable(); > this.datatbl.Columns.Add(new DataColumn("SKU", > System.Type.GetType("System.Int32"))); > this.datatbl.Columns.Add(new DataColumn("Description", > typeof(string))); > this.datatbl.Columns.Add(new DataColumn("Grade", typeof(string))); > } > > private void getData() > { > if (Cache["table"] != null) > { > this.datatbl.Clear(); > Cache.Remove("table"); > } > > DataRow row; > > > row = this.datatbl.NewRow(); > row[0] = "1234"; > row[1] = "Test"; > row[2] = "Test"; > this.datatbl.Rows.Add(row); > > Cache.Insert("table", this.datatbl); > bindGrid(); > > } > > private void bindGrid() > { > this.DataGrid1.DataSource = (DataTable)Cache["table"]; > this.DataGrid1.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. > /// onPageOpen(); > /// </summary> > private void InitializeComponent() > { > 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.Load += new System.EventHandler(this.Page_Load); > onPageOpen(); > } > #endregion > > private void DataGrid1_EditCommand(object source, > System.Web.UI.WebControls.DataGridCommandEventArgs e) > { > this.lblError.Text = "Edit"; > this.DataGrid1.EditItemIndex = (int)e.Item.ItemIndex; > this.lblError.Text = "Edit"; > this.bindGrid(); > this.lblError.Text = "Edit"; > } > > private void DataGrid1_CancelCommand(object source, > System.Web.UI.WebControls.DataGridCommandEventArgs e) > { > this.lblError.Text = "Cancel"; > this.DataGrid1.EditItemIndex = -1; > bindGrid(); > this.lblError.Text = "Cancel"; > } > > private void DataGrid1_UpdateCommand(object source, > System.Web.UI.WebControls.DataGridCommandEventArgs e) > { > this.lblError.Text = "Update"; > this.DataGrid1.EditItemIndex = -1; > bindGrid(); > this.lblError.Text = "Update"; > } > > } > } > > HTML > <%@ Page language="c#" Codebehind="default.aspx.cs" > AutoEventWireup="false" Inherits="DataGridTest.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:datagrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 24px; > POSITION: absolute; TOP: 32px" runat="server" > AutoGenerateColumns="False" DataKeyField="SKU"> > <Columns> > <asp:ButtonColumn Text="Select" > CommandName="Select"></asp:ButtonColumn> > <asp:BoundColumn DataField="SKU" ReadOnly="True" > HeaderText="SKU"></asp:BoundColumn> > <asp:BoundColumn DataField="Description" > HeaderText="Description"></asp:BoundColumn> > <asp:BoundColumn DataField="Grade" > HeaderText="Grade"></asp:BoundColumn> > <asp:EditCommandColumn HeaderText="Edit" EditText="Edit" > CancelText="Cancel" UpdateText="Update" > ButtonType="LinkButton"></asp:EditCommandColumn> > </Columns> > </asp:datagrid><asp:label id="lblError" style="Z-INDEX: 102; LEFT: > 360px; POSITION: absolute; TOP: 536px" > runat="server" Width="376px" Height="32px">g</asp:label></form> > </body> > </HTML> > hello andrew,
MSDN Documents something about CodeBehind .. i am sure u 'll be interested in this .... The Codebehind, Inherits, and Src Attributes In Web Forms that use code-behind files, the @ Page directive (or @ Control in user control files) contains attributes that specify the relationship of the .aspx file and its code-behind file. These attribute are: Codebehind In Visual Studio, this attribute references the name of a file that contains the class for the page. For example, if you create a Web Forms page in Visual Studio called WebForm1, the Codebehind attribute will point to WebForm1.aspx.vb or WebForm1.aspx.cs. This attribute is used only by the Visual Studio Web Forms Designer. It tells the designer where to find the page class so that the designer can create an instance of it for you to work with. The attribute is not used at run time. Inherits Identifies the class from which the page derives. In Visual Studio, this points to a class in the project assembly (.dll), as shown in the diagram above. The code-behind model illustrated above is the model used by Visual Studio. The ASP.NET Framework supports a slightly different code-behind model for Web Forms pages. In the ASP.NET code-behind model, the visual elements are in an .aspx file and the code is in a separate code-only file, as in Visual Studio. However, there is no project, and the code is not pre-compiled. Instead, the code in the .vb or .cs file is compiled at run time, when the page is first requested by a user. The inheritance model works as illustrated above, with the difference that the Web Forms class (WebForm1 class in the diagram) is not part of a project assembly. Instead, each page is a separate assembly. There is no difference in how your code runs in the two models. In the ASP.NET code-behind model, there is no Codebehind page attribute, since that attribute is unique to Visual Studio. To tie the .aspx file to its corresponding code, the page directive contains a Src attribute, which references the file containing the source code for the file. The Src attribute is not supported in Visual Studio. If you import a Web Forms page into Visual Studio that contains the Src attribute, the designer will raise an error. For details, see The file could not be loaded into the Web Forms designer. andrew.robe***@poundland.co.uk wrote: Show quoteHide quote > Thanks for replying it is most appreciated. I posted the same question > on another forum (wont mention the name) and got squat! > > I tried your suggesstion but it still doesn't work. I have posted the > entire code from the aspx and cs files, if you dont mind taking a look. > You might see what I have done wrong. > > Thanks again.
Other interesting topics
detailsview, inserting new record and request.querystring
Error: Content is not allowed between the opening and closing tags for element A question about Repeater control Invalid FORMATETC structure (Exception from HRESULT: 0x80040064(DV_E_FORMATETC)) Get data, make textBoxes, edit values, and re-save to database. Simple? Datagrid soes not page nor edits Menu displays I-Beam cursor, not Hand GridViewUpdateEventArgs not including complete set of OldValues and NewValues Web User Control object reference not set as an instance of an object |
|||||||||||||||||||||||