I have two buttons in an asp.net web page, this buttons are the asp.net control buttons and are not a part of a form, basically I just modify the on click event in the code behind page,

the thing is that when I hit enter one buttons is pressed but I want the other button to be pressed not the first one how can I do this?

Thanks in advance.

You can set the TabIndex property of the buttons accordingly.
Ex: TabIndex of First Button to 0, Second Button to 1 & so on.

try btnAdd.Attributes.Add("OnClick", "return fnsubmit();");

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.