locked
Databinding to a grid RRS feed

  • Question

  • User-1736034386 posted

    Hi,

    I am able to get the data from database and storing it in the dataset and binding that dataset through a function call, but the data is not binding to teh grid. Please help.

    HTML Code:
    
     <tm:TMGrid ID="grdnotificationsschedule"   runat="server" 
                  Width="100%" 
                  CellSpacing="1" GroupingEnabled="False" 
                  ClientIDMode="Predictable"
                  ShowHeader="true"  
                  ClientSettings-AllowColumnsReorder="false" ClientSettings-AllowDragToGroup="false" 
                  AllowMultiRowEdit="true" 
                  AllowMultiRowSelection="true"
                  AllowAutomaticInserts="true"
                  AllowAutomaticDeletes="true"
                  AllowAutomaticUpdates="true"
                  HeaderStyle-VerticalAlign="Bottom" 
                  ShowGroupPanel="false"   HeaderStyle-Font-Bold="true"
                  AllowPaging="true" ValidationSettings-EnableValidation="false" AutoGenerateColumns ="false">
                  <ValidationSettings ValidationGroup="notificationsschedule"  />
               <ClientSettings>
               <Selecting AllowRowSelect="True" EnableDragToSelectRows="False"></Selecting>
               </ClientSettings>
                <MasterTableView  Width="100%" TableLayout= "Auto" EditMode="InPlace" CommandItemDisplay="Top"   AllowSorting="false" AllowCustomPaging="false" AllowFilteringByColumn="false" DataKeyNames = "esid">
                    <CommandItemSettings  ShowRefreshButton="False" ShowSaveChangesButton="false" ShowAddNewRecordButton="false"  />
                    <rowindicatorcolumn visible="false">
                    </rowindicatorcolumn>
                    <ExpandCollapseColumn Created="false" />
                    <Columns>
                          <telerik:GridBoundColumn DataField="EmailType" Groupable="false" UniqueName="EmailType" Display="true" HeaderText = "Email Type" />
                           
                         <telerik:GridTemplateColumn 
                                DataField="Schedule"
                                HeaderText="Schedule" 
                                HeaderStyle-Width="240px"
                                 Groupable="False" 
                                UniqueName="Schedule">
                         <ItemTemplate>
                                <asp:Label runat="server" ID="lblSubject" Text='<%# Eval("Schedule") %>'  />
                         </ItemTemplate>
                         <EditItemTemplate>
                                    <tm:TMTextbox runat="server" ID="tbSchedule" TextMode="SingleLine" MaxLength="150"  />
                         </EditItemTemplate>
                         </telerik:GridTemplateColumn>
                         <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn"  EditImageUrl="~/images/16-edit-pencil.png" CancelImageUrl="~/images/16-cancel.png" InsertImageUrl="~/images/ok22.png" UpdateImageUrl="~/images/ok22.png" UpdateText="Save" EditText="Edit" InsertText="Save" >  </telerik:GridEditCommandColumn>
                         <telerik:GridButtonColumn  ButtonType="ImageButton" ImageUrl="~/images/16-delete-x.png" CommandName="Delete" Text="Delete" UniqueName=""  >
                            <ItemStyle HorizontalAlign="Center" ></ItemStyle>
                        </telerik:GridButtonColumn>
                     </Columns>
             </MasterTableView>
            </tm:TMGrid>
    
    Databinding to the Grid:
    
    grdnotificationsschedule.DataSource = nightlyschedules.Getnotificationschedule(CurrentOrg.ID, CurrentOrg) 
    grdnotificationsschedule.DataBind()
    
    

    Wednesday, September 18, 2013 11:37 AM

Answers

  • User-608283337 posted

    in which event are you binding your grid in code behind?

    The method that is binding the grid with data should be called in page load.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 18, 2013 12:40 PM

All replies

  • User-608283337 posted

    in which event are you binding your grid in code behind?

    The method that is binding the grid with data should be called in page load.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 18, 2013 12:40 PM
  • User-1736034386 posted

    thanks.its working fine.

    Wednesday, September 18, 2013 2:57 PM