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
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
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;
public string adjName;
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="RequiredLabelCla ss" 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 >
<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="RequiredLabelCla
<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 %>"
Text="<%= adjName %>"
What he said ^^. Replace the # with an =. <%= adjName %>
-MJC
-MJC
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
ASKER
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.
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
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
See Comment. I figured it out on my own.