How to get the id value of a button using C#?Ask Questions

 Posted on 01/08/2018 12:00:06 PM

I have a table which gets data from my database. My table has the columns id,name,url and so forth. Under my ID column I have my settings drop down buttons in each row which I created dynamically using this code:

html.Append("<li><button ID='btnDelete' value='"
    + row[column.ColumnName]
    + "' OnClick='btnDelete_Click' runat='server'>Delete</button></li>");

(This is the delete button in the drop down list)

When Inspect the code while Debugging, I can see the ID of each row when I select the delete button. I see it in the "value = ". I want to use that value. Please advice how i can get it on my code.

Share On: facebook gplus twitter
Asked by ketan Linbachiya on 01/08/2018 12:00:06 PM Score: 269 points
Add Comment:


1 Answer

0 Corrected Answers
Answered by Hardik Parekh on Aug 1 2018 1:16PM Score: 238 points

you can use the sender parameter to get button value

try to this


i will try
02/08/2018   13:05:28   Hardi Sananse
thank u !!
02/08/2018   13:04:04   Hardi Sananse
Add Comment:

Post Your Answer


Existing Members

Sign in to your account
Email Address
...or Join us
Download, Vote, Comment, Publish.
Full Name
Email Address
I have read and agree to the Terms of Service and Privacy Policy
Please subscribe me to the StoodQ newsletters
Guideline to answer a question:

Useful tips to submit your answer
Please read below guidelines before you submit your answer for question.

  • Read and understand question for which you are submitting your answer.
  • Try to avoid grammatical and spell mistake while answering.
  • Do not post any irrelevant information in your answer.
  • Explain your answer with example or any reference link to help who posted question.
  • If you find irrelevant question, please report it to support. Click here to contact support.
  • You agree to the privacy policy and terms of use to submit any contents.

Note: StoodQ is online developers community which helps developer for their difficulty, lets help them with your value contribution.