Soumya Rao

Soumya Rao

  • NA
  • 6
  • 4.3k

How to create tabs from data got from Database in SharePoint

May 14 2016 5:40 AM
 I am generating data from SQL Server and displaying it using a calendar. The data is updated according to time and date and changes in every few hours. A few rows of the sample data is below :
 Currency Date & Time Updated Rate
 USD 8:48:00 AM 83.65
 Euro 8:48:00 AM 105.48
 USD 12:30:00 PM 84.65
 Euro 12:30:00 PM 100.48
 
When we click the calendar, the rates for that particular date is populated. How do I create tabs depending on the time that the rates have been updated in the database? i.e. For 12th June, 1 tab for rates updated at 15.04 and another one for rates at 16:04, as shown in the image below :
 
enter image description here
 
My code is as below :
 
<center>
<asp:Calendar runat="server" id="Calendar1" BackColor="White" BorderColor="Black" BorderStyle="Double" FirstDayOfWeek="Monday" ForeColor="Black" DayNameFormat="Full">
<WeekendDayStyle Font-Bold="True" />
</asp:Calendar>
</center>
<br />
<br />
<center>
<asp:GridView runat="server" id="GridView1" AutoGenerateColumns="False" DataSourceID="Rate_Source" BackColor="White" BorderColor="Black" BorderStyle="Double">
<AlternatingRowStyle BackColor="#99CCFF" BorderColor="Black" />
<Columns>
<asp:boundfield DataField="FXCurrency" HeaderText="Currency" SortExpression="FXCurrency">
</asp:boundfield>
<asp:boundfield DataField="DateTimeUpdated" HeaderText="Date & Time Updated" SortExpression="DateTimeUpdated">
</asp:boundfield>
<asp:boundfield DataField="CashBuy" HeaderText="Cash Buy" SortExpression="CashBuy">
</asp:boundfield>
</Columns>
<HeaderStyle BackColor="#66CCFF" />
</asp:GridView>
</center>
<asp:SqlDataSource runat="server" ID="Rate_Source" ConnectionString="Data Source=;Initial Catalog=;User ID=;Password=" ProviderName="" SelectCommand="SELECT [FXCurrency],[DateTimeUpdated],ROUND([CashBuy],2) as Cashbuy FROM [FXRate2] WHERE(CONVERT(CHAR(10),[DateTimeUpdated],120)=@newparameter) ORDER BY [DateTimeUpdated] desc">
<SelectParameters>
<asp:controlparameter ControlID="Calendar1" PropertyName="SelectedDate" Name="newparameter" />
</SelectParameters>
</asp:SqlDataSource>
 

Answers (1)