Click here to Skip to main content
16,014,662 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello sir.
i created a details view control. in the detailsview i took 5 labels and 5 textboxes, in that i placed two asp.net buttons in the item templete. 1 is Save button 2 is Cancel button.
now when ever i click save button i want to save the information in the textboxes in the database.
so how do give the functionality to those buttons.

if anybody plz helpme.

thanking you.
Posted

1 solution

<ItemTemplate>
        <asp:Button ID="Button2" runat="server" CommandName="test" Text="Button" />
</ItemTemplate>

// Item command event
protected void DetailsView1_ItemCommand(object sender, DetailsViewCommandEventArgs e)
    {
        if (e.CommandName == "test")
        {
          // code to save to db.
        }
    }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900