Victor Charles
asked on
Help with passing data to a masked textbox
Hi,
I am able to select data from a listbox and pass it to a regular textbox (ItemA) using the code below,
ItemA.Text = ListBox1.SelectedItem.Text
However the code doesn't work with a masked input box, how do modify the code to pass the value selected from a listbox to a masked input box? I am using ASP.NET.
V.
I am able to select data from a listbox and pass it to a regular textbox (ItemA) using the code below,
ItemA.Text = ListBox1.SelectedItem.Text
However the code doesn't work with a masked input box, how do modify the code to pass the value selected from a listbox to a masked input box? I am using ASP.NET.
V.
ASKER
Hi,
My problem is what is the correct code to pass it the data from the textbox to the listbox when the textbox is masked? The sample code does not tranfer the data the listbox.
Thanks.
My problem is what is the correct code to pass it the data from the textbox to the listbox when the textbox is masked? The sample code does not tranfer the data the listbox.
Thanks.
Hi,
Check the sample code, which is working fine for me!
Hope it helps u...
Check the sample code, which is working fine for me!
<asp:TextBox runat="server" ID="txtBox"></asp:TextBox>
<ajaxToolkit:MaskedEditExtender runat="server" ID="maskedTextBox" MaskType="Number" Mask="99.99" TargetControlID="txtBox">
</ajaxToolkit:MaskedEditExtender>
<asp:ListBox runat="server" ID="listbox" >
<asp:ListItem Text="text1" />
<asp:ListItem Text="text2" />
</asp:ListBox>
<asp:Button runat="server" Text="Add" OnClick="btnClick" />
//Copy the Masked textbox data to Listbox
protected void btnClick(object sender, EventArgs e)
{
listbox.Items.Add(txtBox.Text);
}
Hope it helps u...
ASKER
Sorry, I meant what is the proper code to copy selected item from a listbox to a Masked InputBox?
Hi,
Then try the following code!
Use the same code above, but the button click handler changed
Hope it helps u...
Then try the following code!
Use the same code above, but the button click handler changed
protected void btnClick(object sender, EventArgs e)
{
//Copy the selected value to Masked text box!
txtBox.Text = listbox.SelectedValue;
}
Hope it helps u...
ASKER
I need the text, not the value. This code works when the input control is unmasked, any ideas why it does not work when the control is masked?
C1NSNA.Text = C1NSN.SelectedItem.Text
Thanks.
C1NSNA.Text = C1NSN.SelectedItem.Text
Thanks.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi,
Could not figure the answer from the link, contacted componentone. waitinf to hear bacl from them.
Could not figure the answer from the link, contacted componentone. waitinf to hear bacl from them.
Please check the below sample code!
Open in new window
Hope it helps u...