Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

cant bind to datagrid?

$
0
0
<mesh:SecurePanel runat="server" ID="retentionInvoiceDue" WebMasters="true" Admins="true" style="text-align:left; font-size:small;"><a class="alert" ID="a1">Alerts</a><br><asp:Panel ID="panelToPromptRetentionInvoiceDue" runat="server"
                CssClass="retentionLinksOnHomePage" Visible="true"><asp:DataGrid ID="datagridToPromptRetentionInvoiceDue" runat="server"
                    AutoGenerateColumns="false" GridLines="None" ShowHeader="false"><Columns><asp:TemplateColumn><ItemTemplate><span>Site<asp:LinkButton ID="promptRententionInvoiceLink" CommandArgument='<%# Bind ("id") %>' OnCommand="getSessionVariableForWorkSiteID" runat="server"><asp:Label id="labelBindfromHomeToInvoice" runat="server" Text="<%# Bind('Site_Name') %>"/></asp:LinkButton>retention due for invoicing</span></ItemTemplate></asp:TemplateColumn></Columns></asp:DataGrid></asp:Panel></mesh:SecurePanel>

In cs file I have in page load:

Context db = new Context();

        var allWorkSites =
            (from worksites in db.Work_Sites
             select worksites).Distinct().ToList();

        List<Object> chosenInvoicesForRetention = new List<Object>();

        foreach (Work_Site worksite in allWorkSites)
        {
            if (!worksite.Invoicing_Complete)
            {
                Invoice lastInvoice = worksite.Invoices.OrderBy(w => w.id).LastOrDefault();

                if (lastInvoice != null)
                {
                    if (lastInvoice.Invoice_Date < DateTime.Now.AddMonths(0 - worksite.Number_of_Months))
                    {
                        chosenInvoicesForRetention.Add(worksite);
                    }
                }

            }
        }

        if (chosenInvoicesForRetention.Count == 0)
        {
            panelToPromptRetentionInvoiceDue.Visible = false;
        }

        else
        {
            datagridToPromptRetentionInvoiceDue.DataSource = chosenInvoicesForRetention;
            datagridToPromptRetentionInvoiceDue.DataBind();
        }

    }

Why am I getting the error: panelToPromptRetentionInvoiceDue & datagridToPromptRetentionInvoiceDue does not exist??


I should mention that this code works fine from a different page on my prject, i just copied it over as I want to use it again, but change the table it is being linked too...why would it work from one page and not another?




Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>