Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 13th, 2007, 12:39 PM
Authorized User
 
Join Date: Apr 2006
Location: Virginia Beach, VA, USA.
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default Cannot get Edit Template event to fire

The code displays the data but when I click the edit button it appears to simply refresh the existing ItemTemplate page. What book and chapter has a detailed example about DataList templates? I think I have most of your books.

This is the code that will not bring up the EditItem Template.

<asp:DataList ID="DataList1" runat="server" DataKeyField="C_ID" DataSourceID="SqlDataSource1" Width="259px">
<ItemTemplate>
C_ID:<asp:Label ID="C_IDLabel" runat="server" Text='<%# Eval("C_ID") %>'></asp:Label><br />
C_CompanyName:
<asp:Label ID="C_CompanyNameLabel" runat="server" Text='<%# Eval("C_CompanyName") %>'></asp:Label><br />
C_State:
<asp:Label ID="C_StateLabel" runat="server" Text='<%# Eval("C_State") %>'></asp:Label><br />
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="Edit">LinkButton</asp:LinkButton><br />
</ItemTemplate>
<EditItemTemplate>
C_ID:
<asp:TextBox ID="C_IDTextBox" runat="server" Text='<%# Eval("C_ID") %>'></asp:TextBox><br />
C_CompanyName:
<asp:TextBox ID="C_CompanyNameTextBox" runat="server" Text='<%# Bind("C_CompanyName") %>'></asp:TextBox><br />
C_State:
<asp:TextBox ID="C_StateTextBox" runat="server" Text='<%# Eval("C_State") %>'></asp:TextBox><br />
<asp:LinkButton ID="LinkButton2" runat="server" CommandName="Update">LinkButton</asp:LinkButton>&nbsp;
            <asp:LinkButton ID="LinkButton3" runat="server" CommandName="Cancel">LinkButton</asp:LinkButton><br />
            &nbsp;
</EditItemTemplate>
</asp:DataList>

CODE BEHIND
public partial class admin_DataListBeta001 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void DataList1_EditCommand( object source, DataListCommandEventArgs e )
    {
        DataList1.EditItemIndex = e.Item.ItemIndex;
        DataBind();

    }

}

  #2 (permalink)  
Old February 13th, 2007, 01:13 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there..

is that DataBind ok there???

what happend if you take that out???

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
  #3 (permalink)  
Old February 13th, 2007, 01:42 PM
Authorized User
 
Join Date: Apr 2006
Location: Virginia Beach, VA, USA.
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for the reply.

Tried taking it out (DataBind();), no change. What I don't understand is 1) should the Edit button be a linkbutton or just a plain button? and 2) what actually fires the event telling the EditItem Template to load? I can't believe I am having this much trouble with a simple edit page.

  #4 (permalink)  
Old February 13th, 2007, 02:34 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

maybe this link can help you..
http://www.asp.net/learn/dataaccess/....aspx?tabid=63

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
  #5 (permalink)  
Old February 13th, 2007, 03:29 PM
Authorized User
 
Join Date: Apr 2006
Location: Virginia Beach, VA, USA.
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Exactly what I have been looking for, thank you,

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Explain the event fire in Gridview? venkatu2005 ASP.NET 1.0 and 1.1 Basics 3 April 8th, 2008 08:41 AM
Unable to fire a click event rfinks ASP.NET 1.0 and 1.1 Basics 2 September 1st, 2006 10:26 PM
SelectedIndexChanged Event doesn't fire ddudley3 ASP.NET 2.0 Professional 7 February 6th, 2006 10:47 AM
Can't fire button event more than 1 time goatstudio ASP.NET 2.0 Basics 4 September 22nd, 2004 07:45 AM



All times are GMT -4. The time now is 02:18 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.