How to insert LINQ where parameter in cde behind - asp.net

I want to add a dropdownlist fro user
to select All records, coming 2 months, etc.
and then refresh the gridview.
How can i add the where parameter to linqdatasource by code behind ?
<telerik:RadDropDownList ID="rdl_filter_date" runat="server" OnSelectedIndexChanged="rdl_filter_date_SelectedIndexChanged">
<Items>
<telerik:DropDownListItem Text="All" Value="all" />
<telerik:DropDownListItem Text="Coming 2 months" Value="2mths" />
</Items>
</telerik:RadDropDownList>
<telerik:RadGrid ID="RadGrid1" runat="server" CellSpacing="0" AutoGenerateColumns="False"
DataSourceID="LDS_UpcomingTraining" GridLines="None" Width="700">
<MasterTableView AutoGenerateColumns="False" DataSourceID="LDS_UpcomingTraining">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="db_course.Course_Name"
FilterControlAltText="Filter Course Name"
HeaderText="Course Name" SortExpression="db_course.Course_Name"
UniqueName="db_course.Course_Name" ReadOnly="True">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Start_Time" DataType="System.DateTime"
FilterControlAltText="Filter Start_Time column" HeaderText="Start Time"
ReadOnly="True" SortExpression="Start_Time" UniqueName="Start_Time" DataFormatString="{0:dd-MMM-yyyy hh:mm tt}">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="End_Time" DataType="System.DateTime"
FilterControlAltText="Filter End_Time column" HeaderText="End Time"
ReadOnly="True" SortExpression="End_Time" UniqueName="End_Time" DataFormatString="{0:dd-MMM-yyyy hh:mm tt}">
</telerik:GridBoundColumn>
<telerik:GridHyperLinkColumn Text="View" HeaderText="Online Teaching Material" DataNavigateUrlFields="db_training_session.MaterialURL" Target="_blank" UniqueName="HyperLinkColumn" AllowFiltering="false">
</telerik:GridHyperLinkColumn>
</Columns>
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
<PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
</MasterTableView>
<PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
<FilterMenu EnableImageSprites="False"></FilterMenu>
</telerik:RadGrid>
<asp:LinqDataSource ID="LDS_UpcomingTraining" runat="server"
ContextTypeName="dcLRDBDataContext" EntityTypeName=""
Select="new (db_Course, Start_Time, End_Time, db_Training_Session)"
TableName="db_Employee_Enrollments"
Where="UserID == #UserID && db_Training_Session.Status == #db_Training_Session and Start_Time >= DateTime.Now" OrderBy="Start_Time">
<WhereParameters>
<asp:SessionParameter Name="UserID" SessionField="UserID" Type="Int32" />
<asp:Parameter DefaultValue="Confirmed" Name="db_Training_Session"
Type="String" />
</WhereParameters>
</asp:LinqDataSource>
Code behind
Protected Sub rdl_filter_date_SelectedIndexChanged(ByVal sender As Object, ByVal e As Telerik.Web.UI.DropDownListEventArgs) Handles rdl_filter_date.SelectedIndexChanged
If rdl_filter_date.SelectedValue = "2mths" Then
ElseIf rdl_filter_date.SelectedValue = "all" Then
End If
End Sub

You can set that even in .aspx:
(you'll have to modify Where condition based on param)
<asp:LinqDataSource runat="server" ...>
...
<WhereParameters>
<asp:ControlParameter ControlID="rdl_filter_date" Name="Param" PropertyName="SelectedValue" />
</WhereParameters>
</asp:LinqDataSource>
Second option - use codebehind to set it all. Markup:
<asp:LinqDataSource ID="lds" runat="server" OnSelecting="lds_Selecting" />
Codebehind:
protected void lds_Selecting(object sender, LinqDataSourceSelectEventArgs e) {
var query = ...; // make your query here
e.Result = query;
}

Related

CheckBox Field does not show checked or not in gridview

i'm used checkbox field in gridview to show bit value from database on my gridview
i used default editing row on gridview , when i update row (checked checkbox field)
in database update successfully but in gridview does not show checked or not checked
when i refresh page not show again or when i rerun page same problem as a whole does not show checkbox field bit value status check box filed always is empty and not checkedthis is my gridview html codes
<asp:SqlDataSource ID="sqldsReplys" runat="server" ConnectionString='<%$ ConnectionStrings:ConnectionString %>' UpdateCommand="MNG_Forum_Update_Reply_Status" UpdateCommandType="StoredProcedure" SelectCommand="MNG_Forum_Select_Replys" SelectCommandType="StoredProcedure">
<UpdateParameters>
<asp:Parameter Name="id" Type="Int64" />
<asp:Parameter Name="PostStatus" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
<asp:GridView ID="grdReplys" runat="server" CssClass="GridViewStyle" DataKeyNames="id" AutoGenerateColumns="False" AllowPaging="True" Width="100%" DataSourceID="sqldsReplys">
<Columns>
<asp:CommandField ShowSelectButton="True" ButtonType="Image" SelectImageUrl="~/cpanel/assets/img/sel.png">
</asp:CommandField>
<asp:BoundField DataField="id" HeaderText="ردیف" ReadOnly="true" />
<asp:BoundField DataField="Ptitle" HeaderText="عنوان مطلب" ReadOnly="true" />
<asp:CheckBoxField DataField="PostStatus" HeaderText="وضعیت نمایش" />
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="btnDelete" runat="server" CommandName="delete" ToolTip="حذف این رکورد"
OnClientClick="return confirm('آیا مطمئن هستید؟')" ImageUrl="~/cpanel/assets/img/Trash.png" />
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="True" EditText="ویرایش" UpdateText="تائید" CancelText="لغو" />
</Columns>
<RowStyle CssClass="RowStyle" />
<EmptyDataRowStyle CssClass="EmptyRowStyle" />
<PagerStyle CssClass="PagerStyle" />
<SelectedRowStyle CssClass="SelectedRowStyle" />
<HeaderStyle CssClass="HeaderStyle" />
<EditRowStyle CssClass="EditRowStyle" />
<AlternatingRowStyle CssClass="AltRowStyle" />
</asp:GridView>

radgrid data disappear after filtering

I am using a RadGrid to show some data and I have set AllowFilteringByColumn to true, but when I try to filter rows, a postback occurs and my RadGrid content disappears (all the things disappear and just a border remains).
<telerik:RadAjaxPanel ID="pnlShowGrid" runat="server" LoadingPanelID="RadAjaxLoadingPanel4">
<div class="row-fluid">
<telerik:RadGrid ID="RadGrid1" runat="server"
CssClass="RadGrid" Height="400px"
ClientSettings-Selecting-AllowRowSelect="true"
AllowPaging="True" PageSize="20" AllowSorting="True"
AutoGenerateColumns="False" AllowAutomaticUpdates="True"
ShowStatusBar="True" AllowAutomaticDeletes="True"
AllowFilteringByColumn="True"
Width="100%"
OnUpdateCommand="RadGrid1_UpdateCommand"
OnItemDeleted="rgrd_Edit_ItemDeleted"
OnItemCommand="RadGrid1_ItemCommand">
<ExportSettings ExportOnlyData="True">
<Pdf DefaultFontFamily="Arial Unicode MS" FontType="Embed" />
<Excel AutoFitImages="True" />
</ExportSettings>
<FilterMenu EnableImageSprites="true">
</FilterMenu>
<ExportSettings ExportOnlyData="true" OpenInNewWindow="true">
<Excel Format="ExcelML"></Excel>
<Excel AutoFitImages="true" />
<Pdf FontType="Embed" AllowPrinting="true" />
<Pdf DefaultFontFamily="Arial Unicode MS" />
</ExportSettings>
<ClientSettings AllowGroupExpandCollapse="True" Selecting-AllowRowSelect="true">
<Selecting AllowRowSelect="True" />
</ClientSettings>
<MasterTableView
CommandItemDisplay="TopAndBottom" Dir="RTL" AllowFilteringByColumn="true"
DataKeyNames="AccessPesrmission_ID"
NoDetailRecordsText="??? ?????? ???? ????? !"
NoMasterRecordsText="??? ?????? ???? ????? !">
<CommandItemSettings ExportToPdfText="Export to PDF" AddNewRecordText="????? ????? ????" ShowAddNewRecordButton="false" RefreshText="?????????" ShowExportToExcelButton="true" ShowExportToWordButton="true" ShowExportToPdfButton="false">
</CommandItemSettings>
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" FilterControlWidth="20%"></RowIndicatorColumn>
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column" FilterControlWidth="20%"></ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn Display="false" FilterControlWidth="10px" DataField="AccessPesrmission_ID" DataType="System.Int32" FilterControlAltText="Filter AccessPesrmission_ID column" HeaderText="?????" SortExpression="AccessPesrmission_ID" UniqueName="AccessPesrmission_ID" AndCurrentFilterFunction="Contains" AutoPostBackOnFilter="True" CurrentFilterFunction="Contains">
</telerik:GridBoundColumn>
<telerik:GridCheckBoxColumn DataField="AccessPermission_Read" DataType="System.Boolean" FilterControlAltText="Filter AccessPermission_Read column" HeaderText="?????" SortExpression="AccessPermission_Read" UniqueName="AccessPermission_Read" AndCurrentFilterFunction="Contains" AutoPostBackOnFilter="True" CurrentFilterFunction="Contains">
</telerik:GridCheckBoxColumn>
<telerik:GridCheckBoxColumn DataField="AccessPermission_Add" DataType="System.Boolean" FilterControlAltText="Filter AccessPermission_Add column" HeaderText="???" SortExpression="AccessPermission_Add" UniqueName="AccessPermission_Add">
</telerik:GridCheckBoxColumn>
<telerik:GridCheckBoxColumn DataField="AccessPermission_Edit" DataType="System.Boolean" FilterControlAltText="Filter AccessPermission_Edit column" HeaderText="??????" SortExpression="AccessPermission_Edit" UniqueName="AccessPermission_Edit">
</telerik:GridCheckBoxColumn>
<telerik:GridCheckBoxColumn DataField="AccessPermission_Delete" DataType="System.Boolean" FilterControlAltText="Filter AccessPermission_Delete column" HeaderText="???" SortExpression="AccessPermission_Delete" UniqueName="AccessPermission_Delete">
</telerik:GridCheckBoxColumn>
<telerik:GridBoundColumn Display="false" FilterControlWidth="10px" DataField="AccessPesrmission_SatheSazmani_ID" FilterControlAltText="Filter AccessPesrmission_SatheSazmani_ID column" HeaderText="????? ??? ???????" SortExpression="AccessPesrmission_SatheSazmani_ID" UniqueName="AccessPesrmission_SatheSazmani_ID" AndCurrentFilterFunction="Contains" AutoPostBackOnFilter="True" CurrentFilterFunction="Contains">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn FilterControlWidth="40px" DataField="VahedSazmani_FarsiName" FilterControlAltText="Filter VahedSazmani_FarsiName column" HeaderText="???? ???????" SortExpression="VahedSazmani_FarsiName" UniqueName="VahedSazmani_FarsiName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn FilterControlWidth="40px" DataField="Semat_Name" FilterControlAltText="Filter Semat_Name column" HeaderText="???" SortExpression="Semat_Name" UniqueName="Semat_Name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn FilterControlWidth="40px" DataField="GrooheKarmandi_NameFarsi" FilterControlAltText="Filter GrooheKarmandi_NameFarsi column" HeaderText="???? ???????" SortExpression="GrooheKarmandi_NameFarsi" UniqueName="GrooheKarmandi_NameFarsi">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn FilterControlWidth="40px" DataField="Personel_NameKamel" FilterControlAltText="Filter Personel_NameKamel column" HeaderText="?????" SortExpression="Personel_NameKamel" UniqueName="Personel_NameKamel">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn FilterControlWidth="40px" DataField="COM_Name" FilterControlAltText="Filter COM_Name column" HeaderText="????" SortExpression="COM_Name" UniqueName="COM_Name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn FilterControlWidth="70px" DataField="Source_Desc" FilterControlAltText="Filter Source_Desc column" HeaderText="????" SortExpression="Source_Desc" UniqueName="Source_Desc">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn FilterControlWidth="20px" DataField="SourceType_Desc" FilterControlAltText="Filter SourceType_Desc column" HeaderText="??? ????" SortExpression="SourceType_Desc" UniqueName="SourceType_Desc">
</telerik:GridBoundColumn>
<telerik:GridButtonColumn CommandName="Delete" ButtonType="ImageButton" Text="???"
UniqueName="columnDelete" ConfirmText="??? ?? ?????? ????? ???? ??? ?? ??? ???? ?"
ConfirmDialogType="RadWindow" ImageUrl="../../assets/img/icon/del-layer.png"
ConfirmDialogHeight="180" ConfirmDialogWidth="380" FooterStyle-Width="60px"
HeaderStyle-Width="60px" ItemStyle-Width="60px">
</telerik:GridButtonColumn>
<telerik:GridButtonColumn CommandName="Edit" AndCurrentFilterFunction="Contains"
ButtonType="ImageButton" ImageUrl="../../assets/img/icon/edit.png"
AutoPostBackOnFilter="True" CurrentFilterFunction="Contains" Text="??????"
FooterStyle-Width="60px" HeaderStyle-Width="60px" ItemStyle-Width="60px"
UniqueName="columnEdit">
</telerik:GridButtonColumn>
</Columns>
<EditFormSettings InsertCaption="????? ????? ????" CaptionFormatString="?????? ???? ?? ?? : {0}"
CaptionDataField="COM_ID" EditFormType="Template" PopUpSettings-Modal="true" FormTableStyle-HorizontalAlign="Center" FormCaptionStyle-HorizontalAlign="Center" PopUpSettings-CloseButtonToolTip="????" UserControlName="popupform" PopUpSettings-Width="800">
<EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column"></EditColumn>
<FormTableStyle HorizontalAlign="Center"></FormTableStyle>
<FormCaptionStyle HorizontalAlign="Center"></FormCaptionStyle>
<FormTemplate>
</FormTemplate>
<PopUpSettings Modal="True" Width="800px" CloseButtonToolTip="????"></PopUpSettings>
</EditFormSettings>
<PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
</MasterTableView>
<PagerStyle PageSizeControlType="RadComboBox" />
</telerik:RadGrid>
</div>
<asp:SqlDataSource ID="SqlDataSource_Grid" runat="server" ConnectionString="<%$ ConnectionStrings:PigisConnectionString %>">
<SelectParameters>
<asp:ControlParameter ControlID="ddlCompany" Name="COM_ID" PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="ddlVahedSazmani" Name="VahedSazmani_ID" PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</telerik:RadAjaxPanel>
I load data to the RadGrid with the below function. (I call the function in page load)
void LoadData()
{
SqlDataSource_Grid.SelectParameters.Clear();
SqlDataSource_Grid.SelectCommand = "spSCT_Select_From_SCT_AccessPermission";
SqlDataSource_Grid.DataBind();
RadGrid1.DataSource = SqlDataSource_Grid;
RadGrid1.Rebind();
}
Please add NeedDatasource event in your radgrid.
<telerik:RadGrid runat="server" ID="RadGrid1" OnNeedDataSource="RadGrid1_NeedDataSource">
</telerik:RadGrid>
Your C# code:
protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
SqlDataSource_Grid.SelectParameters.Clear();
SqlDataSource_Grid.SelectCommand = "spSCT_Select_From_SCT_AccessPermission";
SqlDataSource_Grid.DataBind();
RadGrid1.DataSource = SqlDataSource_Grid;
}
It will automatically rebind/databind your radgrid whenever its needed. please check below link for more information.
Commands that invoke Rebind() implicitly
You need to use the RadGrid1_NeedDataSource method where you tell your grid what his datasource should be AND also make sure that you call a Radgrid1.Rebind() at the end of your action method

Delete Query says it has no parameter

I have a Gridview control that I'm trying to allow the users to use the delete button to delete the record from the database. When I click the delete button, it tells me that there is no value for the parameter. Here is the relevant markup:
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/webvideos.mdb"
SelectCommand="SELECT Org_Sec_Atty.ID, ORGANIZATIONS.ORG_NAME, ORG_SECTIONS.SectionName, ATTORNEYS.NAME, ATTORNEYS.LASTNAME, ATTORNEYS.EMAIL, ATTORNEYS.TEL
FROM (ORGANIZATIONS INNER JOIN (Org_Sec_Atty INNER JOIN ATTORNEYS ON Org_Sec_Atty.Atty_ID = ATTORNEYS.ATTY_ID) ON ORGANIZATIONS.ID = Org_Sec_Atty.OrgID) INNER JOIN ORG_SECTIONS ON Org_Sec_Atty.SecID = ORG_SECTIONS.ID;"
DeleteCommand="DELETE FROM Org_Sec_Atty WHERE ID = ?">
<DeleteParameters>
<asp:Parameter Name="ID" Type="Int32" />
</DeleteParameters>
</asp:AccessDataSource>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" PageSize="20"
AllowSorting="True" DataSourceID="AccessDataSource1" >
<Columns>
<asp:CommandField ShowDeleteButton="True" />
<asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" />
<asp:BoundField DataField="ORG_NAME" HeaderText="Organization" SortExpression="ORG_NAME" />
<asp:BoundField DataField="SectionName" HeaderText="Section" SortExpression="SectionName" />
<asp:BoundField DataField="NAME" HeaderText="First Name" SortExpression="NAME" />
<asp:BoundField DataField="LASTNAME" HeaderText="Last Name" SortExpression="LASTNAME" />
<asp:BoundField DataField="EMAIL" HeaderText="E-mail" SortExpression="EMAIL" />
<asp:BoundField DataField="TEL" HeaderText="Phone" SortExpression="TEL" />
</Columns>
</asp:GridView>
I initially forgot to include the Org_Sec_Atty.ID in my SELECT statement and added it in there later when I clicked the delete button and nothing happened. I tried clearing my browser cache with no luck. Any other ideas?
I think that you also need to set the DataKeyNames property in the gridview:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" PageSize="20"
AllowSorting="True" DataSourceID="AccessDataSource1" DataKeyNames="ID" >
This should sort you out.

can't expand (and keep expanded), the detail table for my radgrid.

I'm using a telerik radgrid. I want to expand the item that is currently being edited to show detail. I have created a function to fire when the OnCommand event occurs. What happens is the details expand, and then contract again! It doesn't matter how I set the HierarchyLoadMode for the master or details, I've tried every setting I can think of and it still won't stay expanded when the master data item goes into edit mode.
<%# Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
CodeBehind="Users.aspx.cs" Inherits="WebCallManagerData.Account.Users" %>
<%# Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<script type="text/javascript">
function OnCommand(sender, args)
{
if (args.get_commandName() == 'Edit')
{
rowIndex = args.get_commandArgument();
var radGrid = $find("<%= rgUsers.ClientID %>");
var dataItem = radGrid.get_masterTableView().get_dataItems()[rowIndex];
dataItem.set_expanded(true);
}
else if (args.get_commandName() == 'ExpandCollapse')
{
//dumpObject(args);
}
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:Label ForeColor="Red" Text="" ID="DisplayMessage1" runat="server" />
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="rgUsers">
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManagerProxy>
<telerik:RadGrid ID="rgUsers" runat="server" CellSpacing="0" DataSourceID="odsUsers"
GridLines="None" AutoGenerateColumns="False">
<ClientSettings>
<ClientEvents OnCommand="OnCommand" />
<Selecting CellSelectionMode="None"></Selecting>
</ClientSettings>
<MasterTableView DataSourceID="odsUsers" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
AllowAutomaticUpdates="True" DataKeyNames="UserName" HierarchyLoadMode="Client">
<DetailTables>
<telerik:GridTableView runat="server" DataSourceID="odsUserRole" AllowAutomaticUpdates="True"
AutoGenerateColumns="True" EditMode="EditForms" HierarchyLoadMode="Client">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="UserName" MasterKeyField="UserName" />
</ParentTableRelation>
<CommandItemSettings ExportToPdfText="Export to PDF" />
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
</RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
</ExpandCollapseColumn>
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" FilterControlAltText="Filter EditCommandColumn column">
</telerik:GridEditCommandColumn>
</Columns>
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column" UniqueName="EditCommandColumn1">
</EditColumn>
</EditFormSettings>
</telerik:GridTableView>
</DetailTables>
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" FilterControlAltText="Filter EditCommandColumn column">
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn DataField="UserName" FilterControlAltText="Filter UserName column"
HeaderText="UserName" SortExpression="UserName" UniqueName="UserName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Email" FilterControlAltText="Filter Email column"
HeaderText="Email" SortExpression="Email" UniqueName="Email">
</telerik:GridBoundColumn>
<telerik:GridCheckBoxColumn DataField="Approved" DataType="System.Boolean" FilterControlAltText="Filter Approved column"
HeaderText="Approved" SortExpression="Approved" UniqueName="Approved">
</telerik:GridCheckBoxColumn>
<telerik:GridCheckBoxColumn DataField="LockedOut" DataType="System.Boolean" FilterControlAltText="Filter LockedOut column"
HeaderText="LockedOut" SortExpression="LockedOut" UniqueName="LockedOut">
</telerik:GridCheckBoxColumn>
<telerik:GridBoundColumn DataField="Creation" FilterControlAltText="Filter Creation column"
HeaderText="Creation" SortExpression="Creation" UniqueName="Creation" DataType="System.DateTime">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="LastLogin" DataType="System.DateTime" FilterControlAltText="Filter LastLogin column"
HeaderText="LastLogin" SortExpression="LastLogin" UniqueName="LastLogin">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="LastActivity" DataType="System.DateTime" FilterControlAltText="Filter LastActivity column"
HeaderText="LastActivity" SortExpression="LastActivity" UniqueName="LastActivity">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="LastPasswordChanged" DataType="System.DateTime"
FilterControlAltText="Filter LastPasswordChanged column" HeaderText="LastPasswordChanged"
SortExpression="LastPasswordChanged" UniqueName="LastPasswordChanged">
</telerik:GridBoundColumn>
<telerik:GridCheckBoxColumn DataField="Online" DataType="System.Boolean" FilterControlAltText="Filter Online column"
HeaderText="Online" SortExpression="Online" UniqueName="Online">
</telerik:GridCheckBoxColumn>
<telerik:GridBoundColumn DataField="Password" FilterControlAltText="Filter Password column"
HeaderText="Password" SortExpression="Password" UniqueName="Password">
</telerik:GridBoundColumn>
</Columns>
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column">
</EditColumn>
</EditFormSettings>
</MasterTableView>
<FilterMenu EnableImageSprites="False">
</FilterMenu>
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
</HeaderContextMenu>
</telerik:RadGrid>
<asp:ObjectDataSource ID="odsUserRole" runat="server" SelectMethod="GetUserRoles"
TypeName="WebCallManagerData.Account.MemberShipHelper.User" OldValuesParameterFormatString="original_{0}"
UpdateMethod="UpdateUserRoles">
<SelectParameters>
<asp:Parameter DefaultValue="" Name="UserName" Type="String" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="ur" Type="Object" />
<asp:Parameter Name="UserName" Type="String" />
</UpdateParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="odsUsers" runat="server" SelectMethod="GetAllUsers" TypeName="WebCallManagerData.Account.MemberShipHelper.User">
</asp:ObjectDataSource>
</asp:Content>

Can't "Enable Editing" on my gridview

I'm trying to connect my gridview to a LinqDataSource to select, update, insert and delete records. I am able to get into edit mode and cancel out of edit mode but when I click update nothing happens.
I've found a few things online that say to check the "Enable Editing" box in the gridview smart tag but when I go into the smart tag the only check boxes that appear are: Enable Paging, Enable Sorting and Enable selection. The others don't appear. Dose anyone see a problem with what I am doing below?
<asp:GridView ID="gv_Personnel"
runat="server"
OnRowDataBound="gv_Personnel_DataBind"
AutoGenerateColumns="False"
ShowFooter="True"
DataKeyNames="BudgetLineID"
AutoGenerateEditButton="True"
AutoGenerateDeleteButton="True"
DataSourceID="lds_Personnel"
>
<Columns>
<asp:BoundField HeaderText="Level of Staff" DataField="LineDescription" />
<asp:BoundField HeaderText="Hrs/Units requested" DataField="NumberOfUnits" />
<asp:BoundField HeaderText="Hrs/Units of Applicant Cost Share" DataField="" NullDisplayText="0" />
<asp:BoundField HeaderText="Hrs/Units of Partner Cost Share" DataField="" NullDisplayText="0" />
<asp:BoundField FooterStyle-Font-Bold="true"
FooterText="TOTAL PERSONNEL SERVICES:" HeaderText="Rate"
DataFormatString="{0:C}" DataField="UnitPrice" >
<FooterStyle Font-Bold="True" />
</asp:BoundField>
<asp:TemplateField HeaderText="Amount Requested"
ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right"
FooterStyle-BorderWidth="2" FooterStyle-Font-Bold="true">
<FooterStyle BorderWidth="2px" Font-Bold="True" HorizontalAlign="Right" />
<ItemStyle HorizontalAlign="Right" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Applicant Cost Share"
ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right"
FooterStyle-BorderWidth="2" FooterStyle-Font-Bold="true">
<FooterStyle BorderWidth="2px" Font-Bold="True" HorizontalAlign="Right" />
<ItemStyle HorizontalAlign="Right" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Partner Cost Share"
ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right"
FooterStyle-BorderWidth="2" FooterStyle-Font-Bold="true">
<FooterStyle BorderWidth="2px" Font-Bold="True" HorizontalAlign="Right" />
<ItemStyle HorizontalAlign="Right" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Total Projet Cost"
ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right"
FooterStyle-BorderWidth="2" FooterStyle-Font-Bold="true">
<FooterStyle BorderWidth="2px" Font-Bold="True" HorizontalAlign="Right" />
<ItemStyle HorizontalAlign="Right" />
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:LinqDataSource ID="lds_Personnel" runat="server"
ContextTypeName="nrm.FRGPproposal.FrgpropDataContext"
Select="new (BudgetLineID, UnitPrice, LineDescription, NumberOfUnits)"
TableName="BudgetLines"
Where="ProposalID == #PropNumber && BudgetLineTypeCode == #BudgetLineTypeCode"
EnableDelete="True" EnableInsert="True" EnableUpdate="True">
<WhereParameters>
<asp:SessionParameter Name="PropNumber" SessionField="PropNumber" Type="Int32" />
<asp:Parameter DefaultValue="S" Name="BudgetLineTypeCode" Type="Char" />
</WhereParameters>
</asp:LinqDataSource>
Did you try it without using anonymous types? In code, you can't update anon. types in the database...
Looks like this was caused by me having the Select value set on my LinqDataSoruce. See updated LDS below:
<asp:LinqDataSource ID="lds_Personnel" runat="server"
ContextTypeName="nrm.FRGPproposal.FrgpropDataContext"
TableName="BudgetLines"
Where="ProposalID == #PropNumber && BudgetLineTypeCode == #BudgetLineTypeCode"
EnableDelete="True" EnableInsert="True" EnableUpdate="True">
<WhereParameters>
<asp:SessionParameter Name="PropNumber" SessionField="PropNumber" Type="Int32" />
<asp:Parameter DefaultValue="S" Name="BudgetLineTypeCode" Type="Char" />
</WhereParameters>
</asp:LinqDataSource>

Resources