3

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 Answer 1

3

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
        }

    }
Sign up to request clarification or add additional context in comments.

1 Comment

You might want to check this link as well msdn.microsoft.com/en-us/library/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.