views:

173

answers:

1

Hi! I am a newbie in ASP.NET. I just want to ask if it is possible to create a button or hyperlink in a DetailsView. I know that there are Edit, Delete, etc. in a DetailsView, but I want to create another button or hyperlink for my own function.

Actual Scenario: I have a DetailsView connected in a temporary sql server table via ObjectDataSource. What I need to do is to check/view each data in that table through the DetailsView and if I think the data is correct, I must click a certain button/hyperlink to transfer that data (row) to another table in that DB.

Please help me...

+1  A: 

Select the tiny arrow on top of the details view and select Edit Fields

Double click the ButtonField to add a button...

Change the settings to suit your needs (ButtonType and Text) and most importantly CommandName which might be "Check" for your scenario

And for the event use the ItemCommand event

 void MyDetailView_ItemCommand(Object sender, DetailsViewCommandEventArgs e)
    {

        // Use the CommandName property to determine which button
        // was clicked. 
        if (e.CommandName == "Check")
        {

           //Do Anything you like
        }

    }
Ranhiru Cooray
You might want to check this link as wellhttp://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.detailsview.itemcommand.aspx
Ranhiru Cooray
thanks Ranhiru! This is just what I need... thank you very much...
Kuroro