How to perform functions upon 'bound' data? (asp .net)

  • Thread starter Thread starter murdock
  • Start date Start date
M

murdock

Is there a way to perform functions upon databound data that is to be
used in a GridView? For example, in the following code where I am using
a GridView to display a resulting asp:SqlDataSource

<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False" CellPadding="4"
DataSourceID="SqlDataSource1" ForeColor="#333333"
GridLines="None" Height="402px" Width="612px" AllowSorting="True"
PageSize="50">
<FooterStyle BackColor="#990000" Font-Bold="True"
ForeColor="White" />
<Columns>
<asp:BoundField DataField="Field1"
HeaderText="Switch" SortExpression="Field1" />
<asp:BoundField DataField="Field2"
HeaderText="DateOfPeg" SortExpression="Field2" />
<asp:BoundField DataField="Field3"
HeaderText="TimeInterval" SortExpression="Field3" />
<asp:BoundField DataField="Field4"
HeaderText="Treatment" SortExpression="Field4" />
<asp:BoundField DataField="Field5"
HeaderText="Quantity" SortExpression="Field5" />
</Columns>
<SelectedRowStyle BackColor="#FFCC66" ForeColor="Navy"
Font-Bold="True" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333"
HorizontalAlign="Center" />
<HeaderStyle BackColor="#990000" Font-Bold="True"
ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
</asp:GridView>

Is there something in Visual Studio 2005 Express Edition on the control
itself (somewhere in the properties) to perform an 'action' on a field
prior to insertion?

For example, if you have something formatted oddly in the dataset, and
you have a string Field1 in format "abcdefg" and you wanted to strip
"efg" before putting it into the gridview in the appropriate column.

Regards,
MurdockSE
 
Thank you all very much for your suggestions and the informative links
you have provided. I will report soon on my succcess so others can
benefit from this thread in the future. Thanks again,

MurdockSE
 

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

Back
Top