This is a migrated thread and some comments may be shown as answers.

error in namespace GridDataItem

3 Answers 92 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Radwa
Top achievements
Rank 1
Radwa asked on 07 Oct 2013, 11:55 AM
  The type or namespace name 'GridDataItem' could not be found (are you missing a using directive or an assembly reference?)  
what is the name of its class or namespace and how can i get it
thank you

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 07 Oct 2013, 12:10 PM
Hi,

Please try including 'Telerik.Web.UI' namespace.
Thanks,
Shinu.
0
Radwa
Top achievements
Rank 1
answered on 07 Oct 2013, 01:11 PM
i put this include
but there is another error
aspx page

contain tis code
  <telerik:RadGrid ID="prv_grd" runat="server" Width="700px" CellSpacing="0" DataSourceID="LinqDataSource3" GridLines="None" Height="400px" OnBatchEditCommand="prv_grd_BatchEditCommand" AllowAutomaticUpdates="True" AllowMultiRowEdit="True">
                    <ClientSettings>
                        <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                    </ClientSettings>
                    <MasterTableView AutoGenerateColumns="False" DataSourceID="LinqDataSource3" CommandItemDisplay="TopAndBottom">
                        <BatchEditingSettings EditType="Cell" />
                        <CommandItemSettings CancelChangesText="Cancel " SaveChangesText="Save " ShowAddNewRecordButton="False" ShowCancelChangesButton="True" ShowSaveChangesButton="True"  />
                        <Columns>
                            <telerik:GridBoundColumn DataField="english_name" FilterControlAltText="Filter english_name column" HeaderText="Screen" ReadOnly="True" SortExpression="english_name" UniqueName="english_name">
<ColumnValidationSettings>
<ModelErrorMessage Text=""></ModelErrorMessage>
</ColumnValidationSettings>
                            </telerik:GridBoundColumn>

                            <telerik:GridTemplateColumn DataField="formid" DataType="System.Int32" FilterControlAltText="Filter formid column" HeaderText="formid" SortExpression="formid" UniqueName="formid" Visible="False">
                                <EditItemTemplate>
                                    <asp:TextBox ID="formidTextBox" runat="server" Text='<%# Bind("formid") %>'></asp:TextBox>
                                </EditItemTemplate>

                                <ItemTemplate>
                                    <asp:HiddenField ID="hdn_frmid" runat="server" Value='<%# Eval("formid") %>' />
                                </ItemTemplate>

                            </telerik:GridTemplateColumn>
                         
                           
                         
                            <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn column" HeaderText="View" UniqueName="TemplateColumn">
                                <ItemTemplate>
                                    <asp:CheckBox ID="chk_view" runat="server" Checked='<%# Bind("view_prv") %>' />
                                </ItemTemplate>
                                <HeaderStyle Width="80PX" />
                                <ItemStyle Width="80PX" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column" HeaderText="Add" UniqueName="TemplateColumn1">
                                <ItemTemplate>
                                    <asp:CheckBox ID="chk_add" runat="server" Checked='<%# Bind("add_prv") %>' />
                                </ItemTemplate>
                                <HeaderStyle Width="80PX" />
                                <ItemStyle Width="80PX" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn2 column" HeaderText="Update" UniqueName="TemplateColumn2">
                                <ItemTemplate>
                                    <asp:CheckBox ID="chk_upd" runat="server" Checked='<%# Bind("upd_prv") %>' />
                                </ItemTemplate>
                                <HeaderStyle Width="80PX" />
                                <ItemStyle Width="80PX" />
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn3 column" HeaderText="Delete" UniqueName="TemplateColumn3">
                                <ItemTemplate>
                                    <asp:CheckBox ID="chk_del"  runat="server" Checked='<%# Bind("del_prv") %>' />
                                </ItemTemplate>
                                <HeaderStyle Width="80PX" />
                                <ItemStyle Width="80PX" />
                            </telerik:GridTemplateColumn>
                         
                          
                         
                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>

my cs page contain this
  public void btn_save_Click2(object sender, EventArgs e)
        {

            DataClasses1DataContext dc = new DataClasses1DataContext();
     
            foreach (var prv in query)
            {
                db.sys_prvlgs.DeleteOnSubmit(prv);
            }
  
                foreach (GridDataItem item in prv_grd.MasterTableView.Items)
                {
                    string strID = item.GetDataKeyValue("hdn_frmid").ToString();
                   string formidTextBox = (item.FindControl("formidTextBox") as TextBox).Text;
                    string formidTextBox = item["formidTextBox"].Text;
                }

        }












0
Shinu
Top achievements
Rank 1
answered on 08 Oct 2013, 03:58 AM
Hi,

I have noticed that you have not set the DataKeyNames value in the RadGrid.Please set it as follows in order to access the DataKeyValue from code behind.

ASPX:
<MasterTableView DataKeyNames="hdn_frmid" ...>

Thanks,
Shinu
Tags
Grid
Asked by
Radwa
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Radwa
Top achievements
Rank 1
Share this question
or