Yes...I have seen an abundance of posts regarding this but I'm starting a new thread. I'm almost blind from reading through the original posts and replies but still cannot get the Update and Delete 'buttons' to work in either of these controls...not even
ONCE as was the case for one of our posters.
I have been through the Bob Tabor videos and even following his examples...this just does not do anything. I have sat with his video (I think it's lesson 8...I've run it so many time I shoulds KNOW it's lesson 8...just checked...yes it is!) running, pausing
where necessary to set everything up...nada! Try it on my own stuff...nada. And what's really "fun" about this...I can ALWAYS do an insert. Go figure! I am beginning to formulate a conclusion that these controls, particularly the Update and Delete, are very
idiosyncractic.
I have combed through the various posts here; yes, my DataKeyNames has an appropriate value---even after a schema refresh! (I noticed that someone found that refreshing the schema can often blank the DataKeyNames). All of the code generated in the construction
of these controls seems normal and compares to the various examples I've found. Note that even when I'm not fiddling with any code, parameters, properties or options that Bob Tabor didn't tweak...his worked...mine doesn't...obviously a lot of other users'
efforts don't.
What's up with these controls? Are they as ill-behaved in the 'paid' (not Express) versions of the Studio products?
Eyetech, don't give up just yet. As to the frustration of having nothing work when copied from the tutorials, I am completely sympathetic, having gone through the experience of looking three days to make something work and then when it does work, it is
just a simple thing (I think sometimes one person writes an incomplete tutorial and then 4 people copy them).
I've had success with using SqlDataSource, Gridview and Formviews. I haven't tried DetailsView yet, but while I'm explaining stuff about these three to you, you can reciprocate and explain what we can do with DetailsView, and then we'll work it into the
program.
I'll work with you on this for the long haul, even if it takes up to 50 posts back and forth. I don't think it will though. I'll post complete pages of code for you to try, and after they work we can discuss modifications.
Please tell me which of the following are true:
1)You are working with Visual Web Developer 2005 Express Edition? (I'm thinking this must be a given, since you mentioned Bob Tabor's videos.)
2)Are you working with C# or VB? If you say you're trying a little of both, that's fine too.
3)Are you comfortable with creating tables in the database (primary key, etc.) and adding data (using right click) so that you can populate a table with a few rows before we go to writing code to work with it because for some things, they work, but if there
is nothing in the table, then the code doesn't do anything--it just leaves a blank space there, and if you go back and populate your table with a row, when you return to your page and refresh, suddenly it is working.
I live on the east coast (New York City time). I'm telling you that so you'll have an idea of when to expect replies from me.
I'm going to go ahead and assume you can create a table with the name 'dictionary'
and populate it with three fields:
id - small int {primary} NOT NULL
word - nvarchar(50) NOT NULL
definition - nvarchar(250) NOT NULL
But if you have any questions on that, don't hesitate to ask.
- Larry
(I've prepared a 7 page tutorial specifically for people who want to do the above, and they are GoDaddy customers, so I have quite a few screenshot pictures available for this.)
Someone else could come here looking for help getting started so I'm putting in two things that I think you are already doing.
To create a table in Visual Web Developer 2005 Express Edition:
1.Go over to the Database Explorer, double click on your database (something.mdf) to get a drop down and then right click on Tables and select ‘Add New Table’.
2.Type in the first row- id (in Column Name),smallint (in Data Type) and then click the check box to remove the green checkmark for Allow Nulls.We don’t want to allow nulls for any of the three fields.
3.Similarly, for the second row type word, then nvarchar(50) and then deselect ‘Allow Nulls’.
4.Similarly for the third row type definition, then nvarchar(25) and then deselect ‘Allow Nulls’.
5.Click on the gray box to the left of id.Now the entire row for id is highlighted in gray.
6.Go down to Column Properties and raise the bar to make it bigger.
7.Look for Table Designer (black bold text) then in that look for Identity Specification.Click the + next to Identity Specification.
8.Briefly glance back up to the row with id to confirm that it is still highlighted, and then click on the box with the word No to the right of (Is Identity).Now go over to the triangle on the far right and change that to a Yes.At this point the values underneath of it, Identity Increment and Identity Seed both change to 1, and this is good.
9.Make sure that the row with id is still highlighted, and then go over to the gold key three rows down from the top on the left (when you mouse hover over it the words Set Primary Key come up in a yellow box.Click on that key.
10.Save your file now.A box will come up in the middle of the screen prompting you to give a name to the table.Please name it with the word dictionary using only lower case letters.
1.Right click on the icon for the Table with the name dictionary in the Database Explorer.
2.Go down to the choice ‘Show Table Data’ and click it.Note, it takes more than a few seconds to open this one so don’t panic.
3.When it opens, you should see the word NULL in italics in each row, don’t let that bother you.
4.Click on the word Null in the column for word.Type the word code.
5.Now click on the word Null under definition.Two things happen but don’t worry about those either, even though one of them is the appearance of an angry read circle.You haven’t done any thing wrong.Type the sentence fragment “important information presented in a way to deny understanding to most readers”.
6.There are two rows and the first shows a pencil and the second shows an asterisk.In the row with the asterisk, click on the word NULL in the column with word.Type “obfuscation”.Now click on the word NULL in the definition column and type “the art of creating explanations that create confusion rather than understanding.”
Thanks for your post and offer of assistance. I'm really not quite ready to give up, but these have got to be the most disobedient controls I've ever encountered, particularly when they are touted to be able to do these 'basic' things without a stitch of
extra code. I have been working with databound controls in Access and VB for quite some time and I realize that, especially in the computer/data processing/internet world, nothing is perfect, usually a little poking around into docs, forums, technet, msdn,
one can find something to make things work or to clarify one's understanding of an object, particularly if one misinterpreted something about the object in the first place. I have found though, with the advent of .NET, docs, even the help docs, are getting
a lot skimpier. One thing I could always give Microsoft credit for was solid documentation. Of late, however, I can only give them failing grades in that department. I strongly suspect this is to boost the sales of very expensive books. I guess I shouldn't
complain though; after all this software is free.
To answer some of your questions;
ldechent
Please tell me which of the following are true:
1)You are working with Visual Web Developer 2005 Express Edition? (I'm thinking this must be a given, since you mentioned Bob Tabor's videos.)
2)Are you working with C# or VB? If you say you're trying a little of both, that's fine too.
3)Are you comfortable with creating tables in the database (primary key, etc.) and adding data (using right click) so that you can populate a table with a few rows before we go to writing code to work with it because for some things, they work, but if there
is nothing in the table, then the code doesn't do anything--it just leaves a blank space there, and if you go back and populate your table with a row, when you return to your page and refresh, suddenly it is working.
I live on the east coast (New York City time). I'm telling you that so you'll have an idea of when to expect replies from me.
I'm going to go ahead and assume you can create a table with the name 'dictionary'
and populate it with three fields:
id - small int {primary} NOT NULL
word - nvarchar(50) NOT NULL
definition - nvarchar(250) NOT NULL
1. Yes...Express Edition...I would certainly be willing to buy the 'full' package...I even have an upgrade path...but I grow wary of big brothers whose little siblings are ill behaved.
2. VB for now. I work with C/C++ a little and I've downloaded C# to learn it...but I'm good with VB.
3. I'm quite comfortable with anything to do with Databases, except that taking them to the Web is new for me. In my project, I've gone right into the table data after clicking the update and the updates aren't there. Caching is disabled. And even when I
decide to sleep on the problem, the data isn't mysteriously there in the morning. (Am I starting to sound cynical or what? <blush>) The controls populate with the data just fine, they just won't update or delete...but the Detailsview WILL INSERT! I did pre-populate
my table with some dummy data, leaving some columns empty in some rows then tried updating to add the 'missing' data and to change some of the existing data. Everything stays the same. If I go directly back into the table...it's just as it was.
Anyway...to save my hair color and what little is left of my always questionable sanity...Table "Dictionary" is created.
Assuming that the previous work with constructing and populating a table goes well, the next thing I want us to accomplish is for you to copy the two pages provided below and use them to build a C# code behind system. These worked for me so if a failure
is observed at this stage we will have to conclude that for whatever reason of configuration, we cannot share work (I so much hope this is not the case). If we have success with this, we can build on it, and your question "how can I make these things to delete?"
is resolved.
The code ended on the line above this one (the close html tag was the last line).
And now the code behind file, although at this point there isn't anything in it (I am cautiously optimistic that we will soon be working together on code that requires writing code here). : - )
Eyetech.aspx.cs (the code starts on the next line)
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Eyetech : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
This line is not a part of the code, it ended above.
I hope to hear from you soon that you put in the two pages of code and was able to delete lines from your database. After that we can discuss what did what in the code and move on to another example, editing a database.
I hope to hear from you soon that you put in the two pages of code and was able to delete lines from your database. After that we can discuss what did what in the code and move on to another example, editing a database.
-Larry
Larry,
Yes...all is well to this point. We can continue in C# as well...no problem.
So far we haven't done anything on the code behind page yet. I worked with someone who wanted the page to redirect to another page after the insertion of a new row of data, so in that case we did use the code behind page.
eyetech
Member
21 Points
49 Posts
Update, Delete in Gridview and Detailsview controls don't work
Jan 23, 2007 01:02 AM|LINK
Yes...I have seen an abundance of posts regarding this but I'm starting a new thread. I'm almost blind from reading through the original posts and replies but still cannot get the Update and Delete 'buttons' to work in either of these controls...not even ONCE as was the case for one of our posters.
I have been through the Bob Tabor videos and even following his examples...this just does not do anything. I have sat with his video (I think it's lesson 8...I've run it so many time I shoulds KNOW it's lesson 8...just checked...yes it is!) running, pausing where necessary to set everything up...nada! Try it on my own stuff...nada. And what's really "fun" about this...I can ALWAYS do an insert. Go figure! I am beginning to formulate a conclusion that these controls, particularly the Update and Delete, are very idiosyncractic.
I have combed through the various posts here; yes, my DataKeyNames has an appropriate value---even after a schema refresh! (I noticed that someone found that refreshing the schema can often blank the DataKeyNames). All of the code generated in the construction of these controls seems normal and compares to the various examples I've found. Note that even when I'm not fiddling with any code, parameters, properties or options that Bob Tabor didn't tweak...his worked...mine doesn't...obviously a lot of other users' efforts don't.
What's up with these controls? Are they as ill-behaved in the 'paid' (not Express) versions of the Studio products?
ldechent
Contributor
6326 Points
1577 Posts
Re: Update, Delete in Gridview and Detailsview controls don't work
Jan 23, 2007 02:53 AM|LINK
Eyetech, don't give up just yet. As to the frustration of having nothing work when copied from the tutorials, I am completely sympathetic, having gone through the experience of looking three days to make something work and then when it does work, it is just a simple thing (I think sometimes one person writes an incomplete tutorial and then 4 people copy them).
I've had success with using SqlDataSource, Gridview and Formviews. I haven't tried DetailsView yet, but while I'm explaining stuff about these three to you, you can reciprocate and explain what we can do with DetailsView, and then we'll work it into the program.
I'll work with you on this for the long haul, even if it takes up to 50 posts back and forth. I don't think it will though. I'll post complete pages of code for you to try, and after they work we can discuss modifications.
Please tell me which of the following are true:
1)You are working with Visual Web Developer 2005 Express Edition? (I'm thinking this must be a given, since you mentioned Bob Tabor's videos.)
2)Are you working with C# or VB? If you say you're trying a little of both, that's fine too.
3)Are you comfortable with creating tables in the database (primary key, etc.) and adding data (using right click) so that you can populate a table with a few rows before we go to writing code to work with it because for some things, they work, but if there is nothing in the table, then the code doesn't do anything--it just leaves a blank space there, and if you go back and populate your table with a row, when you return to your page and refresh, suddenly it is working.
I live on the east coast (New York City time). I'm telling you that so you'll have an idea of when to expect replies from me.
I'm going to go ahead and assume you can create a table with the name 'dictionary'
and populate it with three fields:
id - small int {primary} NOT NULL
word - nvarchar(50) NOT NULL
definition - nvarchar(250) NOT NULL
But if you have any questions on that, don't hesitate to ask.
- Larry
(I've prepared a 7 page tutorial specifically for people who want to do the above, and they are GoDaddy customers, so I have quite a few screenshot pictures available for this.)
ldechent
Contributor
6326 Points
1577 Posts
Setting up the table
Jan 23, 2007 03:34 AM|LINK
Someone else could come here looking for help getting started so I'm putting in two things that I think you are already doing.
To create a table in Visual Web Developer 2005 Express Edition:
1. Go over to the Database Explorer, double click on your database (something.mdf) to get a drop down and then right click on Tables and select ‘Add New Table’.
2. Type in the first row- id (in Column Name), smallint (in Data Type) and then click the check box to remove the green checkmark for Allow Nulls. We don’t want to allow nulls for any of the three fields.
3. Similarly, for the second row type word, then nvarchar(50) and then deselect ‘Allow Nulls’.
4. Similarly for the third row type definition, then nvarchar(25) and then deselect ‘Allow Nulls’.
5. Click on the gray box to the left of id. Now the entire row for id is highlighted in gray.
6. Go down to Column Properties and raise the bar to make it bigger.
7. Look for Table Designer (black bold text) then in that look for Identity Specification. Click the + next to Identity Specification.
8. Briefly glance back up to the row with id to confirm that it is still highlighted, and then click on the box with the word No to the right of (Is Identity). Now go over to the triangle on the far right and change that to a Yes. At this point the values underneath of it, Identity Increment and Identity Seed both change to 1, and this is good.
9. Make sure that the row with id is still highlighted, and then go over to the gold key three rows down from the top on the left (when you mouse hover over it the words Set Primary Key come up in a yellow box. Click on that key.
10. Save your file now. A box will come up in the middle of the screen prompting you to give a name to the table. Please name it with the word dictionary using only lower case letters.
ldechent
Contributor
6326 Points
1577 Posts
Populating the table
Jan 23, 2007 03:35 AM|LINK
1. Right click on the icon for the Table with the name dictionary in the Database Explorer.
2. Go down to the choice ‘Show Table Data’ and click it. Note, it takes more than a few seconds to open this one so don’t panic.
3. When it opens, you should see the word NULL in italics in each row, don’t let that bother you.
4. Click on the word Null in the column for word. Type the word code.
5. Now click on the word Null under definition. Two things happen but don’t worry about those either, even though one of them is the appearance of an angry read circle. You haven’t done any thing wrong. Type the sentence fragment “important information presented in a way to deny understanding to most readers”.
6. There are two rows and the first shows a pencil and the second shows an asterisk. In the row with the asterisk, click on the word NULL in the column with word. Type “obfuscation”. Now click on the word NULL in the definition column and type “the art of creating explanations that create confusion rather than understanding.”
eyetech
Member
21 Points
49 Posts
Re: Update, Delete in Gridview and Detailsview controls don't work
Jan 23, 2007 03:36 AM|LINK
Hi Larry:
Thanks for your post and offer of assistance. I'm really not quite ready to give up, but these have got to be the most disobedient controls I've ever encountered, particularly when they are touted to be able to do these 'basic' things without a stitch of extra code. I have been working with databound controls in Access and VB for quite some time and I realize that, especially in the computer/data processing/internet world, nothing is perfect, usually a little poking around into docs, forums, technet, msdn, one can find something to make things work or to clarify one's understanding of an object, particularly if one misinterpreted something about the object in the first place. I have found though, with the advent of .NET, docs, even the help docs, are getting a lot skimpier. One thing I could always give Microsoft credit for was solid documentation. Of late, however, I can only give them failing grades in that department. I strongly suspect this is to boost the sales of very expensive books. I guess I shouldn't complain though; after all this software is free.
To answer some of your questions;
1. Yes...Express Edition...I would certainly be willing to buy the 'full' package...I even have an upgrade path...but I grow wary of big brothers whose little siblings are ill behaved.
2. VB for now. I work with C/C++ a little and I've downloaded C# to learn it...but I'm good with VB.
3. I'm quite comfortable with anything to do with Databases, except that taking them to the Web is new for me. In my project, I've gone right into the table data after clicking the update and the updates aren't there. Caching is disabled. And even when I decide to sleep on the problem, the data isn't mysteriously there in the morning. (Am I starting to sound cynical or what? <blush>) The controls populate with the data just fine, they just won't update or delete...but the Detailsview WILL INSERT! I did pre-populate my table with some dummy data, leaving some columns empty in some rows then tried updating to add the 'missing' data and to change some of the existing data. Everything stays the same. If I go directly back into the table...it's just as it was.
Anyway...to save my hair color and what little is left of my always questionable sanity...Table "Dictionary" is created.
Thanks...
ldechent
Contributor
6326 Points
1577 Posts
Two pages of complete code (one is a code behind) - I use C#
Jan 23, 2007 03:46 AM|LINK
Assuming that the previous work with constructing and populating a table goes well, the next thing I want us to accomplish is for you to copy the two pages provided below and use them to build a C# code behind system. These worked for me so if a failure is observed at this stage we will have to conclude that for whatever reason of configuration, we cannot share work (I so much hope this is not the case). If we have success with this, we can build on it, and your question "how can I make these things to delete?" is resolved.
Eyetech.aspx (the code starts on the next line)
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Eyetech.aspx.cs" Inherits="Eyetech" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Demo 1</title> </head> <body> <form id="form1" runat="server"> <div> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"This line is not a part of the code, it ended above.
I hope to hear from you soon that you put in the two pages of code and was able to delete lines from your database. After that we can discuss what did what in the code and move on to another example, editing a database.
-Larry
eyetech
Member
21 Points
49 Posts
Re: Two pages of complete code (one is a code behind) - I use C#
Jan 23, 2007 04:10 AM|LINK
Larry,
Yes...all is well to this point. We can continue in C# as well...no problem.
ldechent
Contributor
6326 Points
1577 Posts
Re: Two pages of complete code (one is a code behind) - I use C#
Jan 23, 2007 11:10 AM|LINK
I take that to indicate that the two pages worked.
OK, now for a page that has two FormView control servers on it, one that does insert and the other that does editing.
ldechent
Contributor
6326 Points
1577 Posts
Re: Two pages of complete code (one is a code behind) - I use C#
Jan 23, 2007 11:14 AM|LINK
Eyetech2.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Eyetech2.aspx.cs" Inherits="Eyetech2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" DeleteCommand="DELETE FROM [dictionary] WHERE [id] = @original_id AND [word] = @original_word AND [definition] = @original_definition" InsertCommand="INSERT INTO [dictionary] ([word], [definition]) VALUES (@word, @definition)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [dictionary]" UpdateCommand="UPDATE [dictionary] SET [word] = @word, [definition] = @definition WHERE [id] = @original_id AND [word] = @original_word AND [definition] = @original_definition"> <DeleteParameters> <asp:Parameter Name="original_id" Type="Int16" /> <asp:Parameter Name="original_word" Type="String" /> <asp:Parameter Name="original_definition" Type="String" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="word" Type="String" /> <asp:Parameter Name="definition" Type="String" /> <asp:Parameter Name="original_id" Type="Int16" /> <asp:Parameter Name="original_word" Type="String" /> <asp:Parameter Name="original_definition" Type="String" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="word" Type="String" /> <asp:Parameter Name="definition" Type="String" /> </InsertParameters> </asp:SqlDataSource> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" CellSpacing="8" DataKeyNames="id" DataSourceID="SqlDataSource1"> <Columns> <asp:CommandField ShowDeleteButton="True" /> <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" ReadOnly="True" SortExpression="id" /> <asp:BoundField DataField="word" HeaderText="word" SortExpression="word" /> <asp:BoundField DataField="definition" HeaderText="definition" SortExpression="definition" /> </Columns> </asp:GridView> <asp:FormView ID="FormView1" runat="server" DataKeyNames="id" DataSourceID="SqlDataSource1" DefaultMode="Insert"> <EditItemTemplate> id: <asp:Label ID="idLabel1" runat="server" Text='<%# Eval("id") %>'></asp:Label><br /> word: <asp:TextBox ID="wordTextBox" runat="server" Text='<%# Bind("word") %>'> </asp:TextBox><br /> definition: <asp:TextBox ID="definitionTextBox" runat="server" Text='<%# Bind("definition") %>'> </asp:TextBox><br /> <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update"> </asp:LinkButton> <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"> </asp:LinkButton> </EditItemTemplate> <InsertItemTemplate> word: <asp:TextBox ID="wordTextBox" runat="server" Text='<%# Bind("word") %>'></asp:TextBox><br /> definition: <asp:TextBox ID="definitionTextBox" runat="server" Height="80px" Text='<%# Bind("definition") %>' Width="560px"></asp:TextBox><br /> <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert"></asp:LinkButton> <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"></asp:LinkButton> </InsertItemTemplate> <ItemTemplate> id: <asp:Label ID="idLabel" runat="server" Text='<%# Eval("id") %>'></asp:Label><br /> word: <asp:Label ID="wordLabel" runat="server" Text='<%# Bind("word") %>'></asp:Label><br /> definition: <asp:Label ID="definitionLabel" runat="server" Text='<%# Bind("definition") %>'></asp:Label><br /> <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit"></asp:LinkButton> <asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete"></asp:LinkButton> <asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New" Text="New"></asp:LinkButton> </ItemTemplate> </asp:FormView> <asp:FormView ID="FormView2" runat="server" AllowPaging="True" DataKeyNames="id" DataSourceID="SqlDataSource1" DefaultMode="Edit"> <EditItemTemplate> id: <asp:Label ID="idLabel1" runat="server" Text='<%# Eval("id") %>'></asp:Label><br /> word: <asp:TextBox ID="wordTextBox" runat="server" Text='<%# Bind("word") %>'></asp:TextBox><br /> definition: <asp:TextBox ID="definitionTextBox" runat="server" Height="80px" Text='<%# Bind("definition") %>' Width="560px"></asp:TextBox><br /> <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update"></asp:LinkButton> <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"></asp:LinkButton> </EditItemTemplate> <InsertItemTemplate> word: <asp:TextBox ID="wordTextBox" runat="server" Text='<%# Bind("word") %>'> </asp:TextBox><br /> definition: <asp:TextBox ID="definitionTextBox" runat="server" Text='<%# Bind("definition") %>'> </asp:TextBox><br /> <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert"> </asp:LinkButton> <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"> </asp:LinkButton> </InsertItemTemplate> <ItemTemplate> id: <asp:Label ID="idLabel" runat="server" Text='<%# Eval("id") %>'></asp:Label><br /> word: <asp:Label ID="wordLabel" runat="server" Text='<%# Bind("word") %>'></asp:Label><br /> definition: <asp:Label ID="definitionLabel" runat="server" Text='<%# Bind("definition") %>'></asp:Label><br /> <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit"></asp:LinkButton> <asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete"></asp:LinkButton> <asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New" Text="New"></asp:LinkButton> </ItemTemplate> </asp:FormView> </div> </form> </body> </html>ldechent
Contributor
6326 Points
1577 Posts
Re: Two pages of complete code (one is a code behind) - I use C#
Jan 23, 2007 11:18 AM|LINK
Eyetech2.aspx.cs
using
System;using
System.Data;using
System.Configuration;using
System.Collections;using
System.Web;using
System.Web.Security;using
System.Web.UI;using
System.Web.UI.WebControls;using
System.Web.UI.WebControls.WebParts;using
System.Web.UI.HtmlControls;public
partial class Eyetech2 : System.Web.UI.Page{
protected void Page_Load(object sender, EventArgs e){
}
}
So far we haven't done anything on the code behind page yet. I worked with someone who wanted the page to redirect to another page after the insertion of a new row of data, so in that case we did use the code behind page.
-Larry