Gridview check linqDataSource before binding

I have been trying to find a solution for a while regarding the gridviews.

I am using Linq to Sql, but can use something else for the grids.

What I need to do, is check my datasource to see if there are any records, if there are, bind my grid and add a row.
If the datasource is empty then I need to create a fake row so that the header will show.

I have tried multiple ways to implement this, including trying the listview, with no luck.

I have attached my latest attempt, hoping that someone can help me so I can move on with this project.

In this example I am using sqldatasource, but I would prefer to use linq to sql.

          <td align="right" colspan="2">
              <asp:GridView ID="grdDefaults" runat="server" AllowSorting="True" 
                  AutoGenerateColumns="False" AutoGenerateDeleteButton="True" 
                  AutoGenerateEditButton="True" BorderColor="LightGray" Font-Size="8pt" 
                  ShowFooter="True" Width="100%" DataSourceID="sqldsWorkDays">
                  <AlternatingRowStyle BackColor="#FFFFCC" />
                      <asp:TemplateField ShowHeader="False">
                              <asp:Label ID="DefaultWorkDaysID" runat="server" 
                                  Text='<%# Bind("DefaultWorkDaysID") %>' Visible="False" />
                      <asp:TemplateField ShowHeader="False">
                              <asp:Label ID="DefaultID" runat="server" Text='<%# Bind("DefaultID") %>' 
                                  Visible="False" />
                      <asp:TemplateField HeaderText="Day of Week">
                              <asp:DropDownList ID="DDDOW" runat="server" 
                                  DataTextField='<%# Bind("WorkDay") %>' DataValueField='<%# Bind("WorkDay") %>'>
                              <asp:ListSearchExtender ID="ListSearchExtender1" runat="server" 
                          <ControlStyle BorderStyle="None" Width="100%" />
                      <asp:TemplateField HeaderText="Start Time">
                              <asp:TextBox ID="txtStartTime" runat="server" Text='<%# Bind("StartTime") %>'></asp:TextBox>
                              <asp:MaskedEditExtender ID="MaskedEditExtender1" runat="server" 
                                  AcceptAMPM="true" Mask="99:99" MaskType="Time" TargetControlID="txtStartTime">
                          <ControlStyle BorderStyle="None" Width="100%" />
                          <HeaderStyle Width="24%" />
                      <asp:TemplateField HeaderText="End Time">
                              <asp:LinkButton ID="lnkDefaultNewRow" runat="server" Font-Bold="False" 
                                  Font-Size="9pt" OnClick="lnkAddNewRow_Click" >Add New Row</asp:LinkButton>
                              <asp:TextBox ID="txtEndTime" runat="server" Text='<%# Bind("EndTime") %>'></asp:TextBox>
                              <asp:MaskedEditExtender ID="MaskedEditExtender2" runat="server" 
                                  AcceptAMPM="true" Mask="99:99" MaskType="Time" TargetControlID="txtEndTime">
                          <ControlStyle BorderStyle="None" Width="100%" />
                          <HeaderStyle Width="24%" />
                  <HeaderStyle BackColor="DarkBlue" Font-Size="9pt" ForeColor="White" />
              <asp:SqlDataSource ID="sqldsWorkDays" runat="server" OnDataBinding="AddRowIfNecessary" 
                  ConnectionString="<%$ ConnectionStrings:SalonConnectionString %>" 
                  DeleteCommand="DELETE FROM [DefaultWorkDays] WHERE [DefaultWorkDaysID] = @DefaultWorkDaysID" 
                  InsertCommand="INSERT INTO [DefaultWorkDays] ([DefaultID], [WorkDay], [StartTime], [EndTime]) VALUES (@DefaultID, @WorkDay, @StartTime, @EndTime)" 
                  SelectCommand="SELECT * FROM [DefaultWorkDays] WHERE ([DefaultID] = @DefaultID)" 
                  UpdateCommand="UPDATE [DefaultWorkDays] SET [DefaultID] = @DefaultID, [WorkDay] = @WorkDay, [StartTime] = @StartTime, [EndTime] = @EndTime WHERE [DefaultWorkDaysID] = @DefaultWorkDaysID">
                      <asp:Parameter Name="DefaultWorkDaysID" Type="Int32" />
                      <asp:Parameter Name="DefaultID" Type="Int32" />
                      <asp:Parameter Name="WorkDay" Type="String" />
                      <asp:Parameter Name="StartTime" Type="Int32" />
                      <asp:Parameter Name="EndTime" Type="Int32" />
                      <asp:ControlParameter ControlID="txtDefaultID" Name="DefaultID" 
                          PropertyName="Text" Type="Int32" />
                      <asp:Parameter Name="DefaultID" Type="Int32" />
                      <asp:Parameter Name="WorkDay" Type="String" />
                      <asp:Parameter Name="StartTime" Type="Int32" />
                      <asp:Parameter Name="EndTime" Type="Int32" />
                      <asp:Parameter Name="DefaultWorkDaysID" Type="Int32" />

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Muhammad ZamanSoftware Development LeadCommented:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.