By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,616 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

populating text box based on drop down list

P: 48
I have a text box called pro and a drop down list called scac. I am wanting to format the text box based on what is selected in the drop down. ex. pro is 1234564 and i want to format is based on the scac ABC to make it 1236-4564. I want to be able to add the format to be able to match how the scac code is formatted, whether it is separated by a space or a "-". If there is any information that i can give to help, then please let me know.
Sep 17 '15 #1
Share this Question
Share on Google+
3 Replies


100+
P: 299
Do you have a current bit of code that you're trying and it isn't working? That'd be the first step.
Sep 17 '15 #2

P: 48
i do not have any code for that because i am not really sure where to start.
here is my textbox for the pro
Expand|Select|Wrap|Line Numbers
  1. <div style="min-height: 5px;"></div>
  2.                     <div style="padding-top: 3px; padding-bottom: 3px;">
  3.                         <div style="float: left; width: 75px; text-align: right; padding-right: 5px;">Pro: </div>
  4.                         <div style="float: left; text-align: left;">
  5.                             <asp:TextBox ID="tbProNumber" Width="115px" runat="server"></asp:TextBox>
  6.                             &nbsp;OR
  7.                         </div>
  8.                         <div style="clear: both"></div>
  9.                     </div>
here is the code for the drop down list
Expand|Select|Wrap|Line Numbers
  1.   <div style="padding-top: 3px; padding-bottom: 10px;">
  2.                         <div style="height: 18px">Carrier/SCAC </div>
  3.                         <div style="text-align: center; width: 100%">
  4.  
  5.                             <asp:DropDownList runat="server" EnableViewState="true" ID="ddlScacs" AutoPostBack="True"></asp:DropDownList>
  6.                             <div style="min-height: 4px;"></div>
  7.                             <asp:DropDownList runat="server" EnableViewState="true" ID="ddlCarriers" Width="130px" AutoPostBack="True"></asp:DropDownList>
  8.                         </div>
right now when you select something from the dropdown list, nothing changes in the pro text box
Expand|Select|Wrap|Line Numbers
  1.  Protected Sub ddlCarriers_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ddlCarriers.SelectedIndexChanged
  2.         ddlScacs.SelectedIndex = ddlCarriers.SelectedIndex
  3.     End Sub
  4.  
  5.     Protected Sub ddlScacs_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ddlScacs.SelectedIndexChanged
  6.         ddlCarriers.SelectedIndex = ddlScacs.SelectedIndex
  7.     End Sub
I do not have anything in the textchanged for the pro number yet.

i think that i would just populate the text box based on the selection from the carrier dropdown list and the scac dropdown list. every carrier has a different format for the pro. so i need to format the pro text box based on the selection. Some of them have the format of "123 1234 0" and others 12-123-456", they are different. please help!
Sep 23 '15 #3

100+
P: 293
@lillyehrhart ,

May be this is the one you are looking for -

Adding a format to the TextBox in asp.net [closed]

Please let me know for any issues or clarifications.

Best Regards.
Sep 25 '15 #4

Post your reply

Sign in to post your reply or Sign up for a free account.