Link to home
Start Free TrialLog in
Avatar of RecipeDan
RecipeDan

asked on

Textbox Value

Hello:

I am trying to show a value in a textbox that I got from a database table. I know the data is pulling the values correctly. Here is my textbox:

<asp:TextBox ID="NameText" Text="<%# adjName %>" runat="server" Width="200px" />

Dan
Avatar of kaufmed
kaufmed
Flag of United States of America image

Unfortunately, that is not enough markup to go on. We would need to see what container you are using (e.g. Repeater, GridView, etc.) in order to give you proper syntax to databind with. Can you elaborate?
If adjName is a server side variable with the value you want to assign, then it must be declared public in your server code in order to acces it with <%# adjName %> in aspx page.

        public string adjName;
Avatar of RecipeDan
RecipeDan

ASKER

OK hereis my whole aspx:

 <ajaxToolkit:TabContainer ID="ProfileContainer" TabStripPlacement="Top" runat="server" Width="650" BorderColor="Black" ActiveTabIndex="0">
<ajaxToolkit:TabPanel runat="server" HeaderText="Header1" ID="Tab1">
        <ContentTemplate>
            <table cellpadding="3" style="width: 558px">
            <tr>
            <td><asp:Label runat="server" CssClass="RequiredLabelClass" Text="Name:" ID="NameLabel" /></td>
            <td><<asp:TextBox ID="NameText" Text="<%# adjName %>" runat="server" Width="200px" /></td>
            </tr>

            </table>
        </ContentTemplate>

        </ajaxToolkit:TabPanel>
       
        <ajaxToolkit:TabPanel runat="server" HeaderText="Header2" ID="Tab2">
           
        </ajaxToolkit:TabPanel>
   
    </ajaxToolkit:TabContainer>
so adjName is a varibale in the server side ? If yes, like tommyboy said .. make it public and then try accessing it like this

Text="<%= adjName %>"
What he said ^^.  Replace the # with an =.  <%= adjName %>

-MJC
SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Assuming it's a publicly declared server variable, it would have to be done using javascript.
What about code-behind?  ; )
You're right, it would be kind of pointless.
Hello:

The tab container itself is not connected to a datasource. I have a form in the tab container that I want to get values from a database. The values are pulling from he database because I tested it with asp:label and the values show. I can't get the values to show in the textbox.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
See Comment. I figured it out on my own.