TabIndex for two control contained with a table cell ASP.Net - 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 any 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.

Related

How to reset a gridview?

I have a gridview which takes inputs from a textbox. Multiple values can be added to it. I want to rest the grid. I have tried few codes in the internet. But just clear the grid. When i type the numbers again all the previous numbers appear. I want to remove previous numbers too when i reset the grid. How can i do it?
Here is my back end code
if (grdPolicyDetails.Rows.Count > 0)
{
grdPolicyDetails.Columns.Clear();
grdPolicyDetails.DataBind();
}
I have tried this code too. This too didn't work.
grdPolicyDetails.DataSource = null;
grdPolicyDetails.DataBind();
Are you talking about the History of Browser ? if yes then,
If Clear Gridview Data then,
grdpolicydetails.Controls.Clear();

Delete row button in alv grid in sap

i am using function "REUSE_ALV_GRID_DISPLAY" in order to display a grid. My problem is that not all the buttons in alv toolbar are displayed. For example, i can not see the "delete row" button.
This is my call:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_FIELDCAT = fieldcatalog
TABLES
t_outtab = lt_files_records_final
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
Can you please help?
IF you need the full editor functionality (including cell editors), you will have to move away from the (obsolete and unsupported) function module to the class CL_GUI_ALV_GRID. See the documentation here.
If you only need a delete button, it might be easier to add a custom button. Check the program SALV_DEMO_TABLE_FUNCTIONS for an example (and start using the ALV OM instead of the old function modules - much easier to code with).

Flex ApplyFormatOperation Breaks Undo/Redo in Spark TextArea

This is my first question on here. So.. I apologize if I ask this poorly.
I've written a syntax highlighted text editor that extends the spark TextArea.
The highlighting works by applying ApplyFormatOperations to the various different sections of text. However, as soon as I apply any format operations, I lose all the built in undo/redo functionality. I turn off the colorizing and undo redo comes back.
Here's a simplified version of what I'm doing that wipes out undo/redo.
Imagine this gets triggered every time you type a character.
//select everything
var operationState:SelectionState = new SelectionState(textFlow, 0, text.length);
//make an example format.
var exampleFormat:TextLayoutFormat = new TextLayoutFormat();
//everytime we run change the color of all the the text.
m_undoTest = !m_undoTest;
if (m_undoTest) {
exampleFormat.color = "#0839ff"; //make all text bluish.
} else {
exampleFormat.color = "#ff0839"; //make all text redish.
}
//make an operation to apply my formatting.
var formatOperation:ApplyFormatOperation = new ApplyFormatOperation(operationState, exampleFormat, null);
//apply the operation to the text area.
formatOperation.doOperation();
Now my text toggles from red to blue as I type and I can no longer undo. Interestingly if I do the same steps but don't change any properties in the new format. IE don't toggle the color everytime we run. Undo Redo does still work.
Any help would be greatly appreciated, thanks :)
Well... I got further on this, by piping all my operations through the "editManager" class I no longer lose the undo redo history. But... the colorization now counts as an undoable action... which as you might imagine is not ideal. So, now intermixed with your actual undos you have ones that remove all the syntax highlighting. Still trying to figure out a way around that.
The jist of the current implementation is this:
var editManager:IEditManager = textFlow.interactionManager as IEditManager;
//make an operation to apply my formatting.
var formatOperation:ApplyFormatOperation = new ApplyFormatOperation(operationState, exampleFormat, null);
//apply the operation to the text area.
editManager.doOperation(formatOperation);

Is it possible to raise the validator for text box on drop down changed

Hi all generally we can handle validators on Button click or when the control is left empty. I am having my requirement as follows
I am having a text box and a drop down where the drop down list is binded with database values as follows
mlocal_strStoredProcName = USADAO.StoredProcNames.PayFrequency_uspPayFrequencySelect;
oEmployee.Select(out mlocal_ds, mlocal_strStoredProcName);
ddlPaymentType.DataSource = mlocal_ds;
ddlPaymentType.DataTextField = TablesAndColumns.tblPayFrequency_PayFrequencyDesc;
ddlPaymentType.DataValueField = TablesAndColumns.tblPayFrequency_PayFrequencyTypeID;
ddlPaymentType.DataBind();
ddlPaymentType.Items.Insert(0, "Select");
mlocal_ds.Clear();
What i need is if the text box is left empty on ddlPaymentType_SelectedIndexChanged i would like to fire the validator is it possible to do if so can any one give me an idea
Got the answer just used
Page.validate("g")

2 Mutually exclusive RadioButton "Lists"

I think this has to be THE most frustrating thing I've ever done in web forms. Yet one would think it would be the easiest of all things in the world to do. That is this:
I need 2 separate lists of radiobuttons on my .aspx page. One set allows a customer to select an option. The other set does also but for a different purpose. But only one set can have a selected radiobutton.
Ok I've tried this using 2 asp.net Radiobuttonlists controls on the same page. Got around the nasty bug with GroupName (asp.net assigns the control's uniqueID which prevents the groupname from ever working because now, 2 radiobuttonlists can't have the same groupname for all their radiobuttons because each radiobuttonlist has a different uniqueID thus the bug assigns the unique ID as the name attribute when the buttons are rendered. since the name sets are different, they are not mutually exclusive). Anyway, so I created that custom RadioButtonListcontrol and fixed that groupname problem.
But when ended up happening is when I went to put 2 instances of my new custom radiobuttonlist control on my .aspx page, all was swell until I noticed that every time I checked for radiobuttonlist1.SelectedValue or radiobuttonlist2.SelectedValue (did not matter which I was checking) the value always spit back string.empty and i was not able to figure out why (see http://forums.asp.net/t/1401117.aspx).
Ok onto the third try tonight and into the break of dawn (no sleep). I tried to instead just scrap trying to use 2 custom radiobuttonlists altogether because of that string.empty issue and try to spit out 2 sets of radiobuttonlists via using 2 asp.net repeaters and a standard input HTML tag inside. Got that working. Ok but the 2 lists still are not mutually exclusive. I can select a value in the first set of radiobuttons from repeater1 and same goes for repeater2. I cannot for the life of me get the "sets" to be mutually exclusive sets of radiobuttons.
As you have two groups of radio buttons that you want to function as one group of radio buttons, the solution is simple: Make it one group of radio buttons.
The only problem you have then is that the value that you get has the same name from both lists, but that can be solved by adding a prefix to the values so that you easily identify from which list the option comes.
Update: based on the new info posted as an answer. The option I proposed on my original answer corresponds to the 3. You really must consider the following:
Html radio buttons have only 1
built-in mechanism to handle the
exclusivity, which is the name.
You are explicitly requesting a no js solution, so given the above you must manipulate the Ids to achieve it. If you weren't blocking this option I am sure someone would come up with some nice jquery or js library that already supports it.
The option 3 is clearly the less invasive, as you are not forced to affect the actual data, and are not affected by future updates to it.
It's not that much code, just something extra on the List indexes, and some simple thing as:
int? list1Value = null;
int? list2Value = null;
var value = Request.Form["somegroup"];
if (value.StartsWith("List1"))
list1Value = int.Parse(value.Substring(5));
else
list2Value = int.Parse(value.Substring(5));//Assuming List2 as prefix
Original:
I saw your other question, and you just need to use the same group name. Make sure you have different values for all items regardless of the list they come from. A way to achieve this is adding something to the values, like: <%# "List1-" + Eval("ID") %> and modifying the code that reads your Request.Form["yourgroupname"].
I think you should just use RadioButtons instead of RadioButtonLists.
Here's an article that presents a solution to resolve the radiobutton naming bug.
Though this post is dated 1 year ago already, I just read it because I face the same problem.
Currently I have 1 solution using jQuery:
Client side script (you must also include jQuery)
function SetRadio(rb) {
$('input:checked').attr('checked', false);
rb.checked = true;
}
For every radiobutton (which is a listitem in a radiobuttonlist) I add the following on the serverside:
li.Attributes.Add("onclick", "javascript:SetRadio(this)");
For me this works in both IE and Firefox, with 3 radiobuttonlists, without using groupnames.
You can check each radiobuttonlist for a selecteditem/value, or you can extend the SetRadio function so it stores the selected value in a hidden field.
Regards,
M

Resources