TabIndex for two control contained with a table cell ASP.Net
I have a weird issue that I am being asked to fix but alas I have thus far drawn a blank. As the title suggests I am trying to get the tab order for two text boxes to follow one after the other.
The idea is (and this is inherited code rather than that of my own design) that a routine is call that builds atable cell inserting two text boxes and one link. This is then returned and foreach line in the table a new copy of this cell is generated.
I have tried setting the TabIndex for the text boxes and find that when I tab I only get as far as the first box (txtPound) and never the second (txtPence).
I can't decide if the issue is due to trying to do this in a TableCell or whether its something else completely.
Hopefully that's clear but should you require 开发者_如何学Cany further info then I will try to supply it.
I have included a striped down version of the code below, essentially this gets added to a table row in a the aspx pace.
Any help would be greatly appreciated.
private TableCell EstimateInputs(Brief item)
{
TableCell td = new TableCell();
TextBox txtPounds = new TextBox();
string[] agencyCosts;
txtPounds.TabIndex = 1;
td.Controls.Add(txtPounds);
//td.Controls.Add(new LiteralControl("<span>.</span>"));
TextBox txtPence = new TextBox();
txtPence.MaxLength = 2;
txtPence.TabIndex = 2;
td.Controls.Add(txtPence);
td.Controls.Add(new LiteralControl("</p></fieldset>"));
}
So it ended up being a complete red herring. turns out that there was a little JavaScript function that is applied to text boxes that deal with monetary values. it stops anything other than a numerical key press which means it includes the tab key.
So the mystery is solved - thanks for the help.
精彩评论