GridControl question

  • Thread starter Sheldon Glickler
  • Start date
S

Sheldon Glickler

I am progressing rapidly olong my learning curve and now have a question
about GridView. With the control, I now pull back data and have as part of
my spec:

<asp:boundfield DataField="propertyStreet" HeaderText="propertyStreet"
SortExpression="propertyStreet"></asp:boundfield>

<asp:boundfield DataField="propertyCity" HeaderText="propertyCity"
SortExpression="propertyCity"></asp:boundfield>

<asp:boundfield DataField="propertyState" HeaderText="propertyState"
SortExpression="propertyState"></asp:boundfield>

<asp:boundfield DataField="propertyZip" HeaderText="propertyZip"
SortExpression="propertyZip"></asp:boundfield>

Of course, this in four columns. I would like to have the table have all
these data in one column called Address where the data would appear as:

propertyStreet<br>propertyCity, propertyState propertyZip

In other words the address on one line and the city comma space state space
zip on the next line.

How do I do this?

Shelly
 
S

Shelly

Muhammad Naveed Yaseen said:
Use TemplateField

Could you point me to a good example to do what I want? I searched the web
for TemplateView and didn't find anything.

Shelly
 
M

Muhammad Naveed Yaseen

<asp:GridView runat="server" ID="GridView1">
<Columns>
<asp:TemplateField HeaderText="Address">
<ItemTemplate>
<%# Eval("propertyStreet") %><br />
<%# Eval("propertyCity") %>, <%#
Eval("propertyState") %> <%# Eval("propertyZip") %>
</ItemTemplate>
<EditItemTemplate><%-- Include this
EditItemTemplate only if editing is required --%>
<asp:TextBox runat="server" ID="txtStreet"
Text='<%# Bind("propertyStreet") %>' /><br />
<asp:TextBox runat="server" ID="txtCity"
Text='<%# Bind("propertyCity") %>' />, <asp:TextBox runat="server"
ID="txtState" Text='<%# Bind("propertyState") %>' /> <asp:TextBox
runat="server" ID="txtZip" Text='<%# Bind("propertyZip") %>' />
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,197
Latest member
Sean29G025

Latest Threads

Top