I don't get the value in radgrid itemcomman how i pass in the need data soucrce
please replay as soon as possible
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NewModels.aspx.cs" Inherits="TBS_HelpDesk.Views.Assets.NewModels"
MasterPageFile="~/Views/Shared/MasterPage.Master" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="aboutContent" ContentPlaceHolderID="MainContent" runat="server">
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" UpdatePanelHeight="" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadGrid runat="server" ID="RadGrid1" CellPadding="0" GridLines="None" AutoGenerateColumns="False"
AllowPaging="True" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemCommand="RadGrid1_ItemCommand">
<MasterTableView>
<Columns>
<telerik:GridBoundColumn DataField="Manuf_ID" DataType="System.Int32" HeaderText="Manuf ID"
SortExpression="Manuf_ID" UniqueName="Manuf_ID" Visible="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Manuf_Name" HeaderText="Manuf Name" SortExpression="Manuf_Name"
UniqueName="Manuf_Name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Manuf_Description" HeaderText="Manuf Description"
SortExpression="Manuf_Description" UniqueName="Manuf_Description">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings EnablePostBackOnRowClick="true">
<Selecting AllowRowSelect="True" />
</ClientSettings>
</telerik:RadGrid>
<telerik:RadGrid runat="server" ID="RadGrid2" CellPadding="0" GridLines="None" AutoGenerateColumns="False"
AllowPaging="True" Skin="WebBlue" OnItemCommand="RadGrid1_ItemCommand" OnNeedDataSource="RadGrid2_NeedDataSource">
<MasterTableView CommandItemDisplay="Top" EditFormSettings-PopUpSettings-Modal="true"
EditMode="PopUp">
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" />
<telerik:GridNumericColumn DataField="Model_ID" HeaderText="Model Id" SortExpression="Model_ID"
UniqueName="Model_ID" Visible="false" ReadOnly="true">
</telerik:GridNumericColumn>
<telerik:GridBoundColumn DataField="Model_Name" HeaderText="Model Name" SortExpression="Model_Name"
UniqueName="Model_Name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Model_Description" DataType="System.Boolean"
HeaderText="Model Description" SortExpression="Model_Description" UniqueName="Model_Description">
</telerik:GridBoundColumn>
<telerik:GridButtonColumn CommandName="Delete" ButtonType="ImageButton" UniqueName="DeleteColumn"
CommandArgument="Child" ConfirmDialogType="RadWindow" ConfirmText="Are You Sure Want To Delete This Record?"
ConfirmTitle="Delete Confirm" />
</Columns>
</MasterTableView>
</telerik:RadGrid>
</asp:Content>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.IO;
using Telerik.Web.UI;
using System.Data.SqlClient;
using System.Configuration;
namespace TBS_HelpDesk.Views.Assets
{
public partial class NewModels : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//if (!IsPostBack)
//{
// LoadManufacturers();
//}
}
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
DataTable dtTable = new DataTable();
string conn = ConfigurationManager.ConnectionStrings["TBSHelpDeskLiveDB_ConnectionString"].ToString();
SqlDataAdapter sqladp = new SqlDataAdapter();
SqlConnection sqlconn = new SqlConnection(conn);
sqlconn.Open();
try
{
string selectQuery = "SELECT Manuf_ID,Manuf_Name,Manuf_Description FROM [AssetManufacturers] order by Manuf_ID asc";
sqladp.SelectCommand = new SqlCommand(selectQuery, sqlconn);
sqladp.Fill(dtTable);
RadGrid1.DataSource = dtTable;
}
finally
{
sqlconn.Close();
}
}
protected void RadGrid2_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
SqlConnection connection = new SqlConnection(
ConfigurationManager.ConnectionStrings["TBSHelpDeskLiveDB_ConnectionString"].ConnectionString);
SqlDataAdapter adapter = new SqlDataAdapter("SELECT Model_ID,Model_Name,Model_Description FROM " +
" AssetModels WHERE Model_Manuf_ID = ", connection);
DataTable dt = new DataTable();
adapter.Fill(dt);
RadGrid2.DataSource = dt;
}
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == "RowClick")
{
GridDataItem item = (GridDataItem)e.Item;
string Manuf_ID = item["Manuf_ID"].Text;
LoadModels(Manuf_ID);
}
}
protected void LoadModels(string Manuf_ID)
{
SqlConnection connection = new SqlConnection(
ConfigurationManager.ConnectionStrings["TBSHelpDeskLiveDB_ConnectionString"].ConnectionString);
SqlDataAdapter adapter = new SqlDataAdapter("SELECT Model_ID,Model_Name,Model_Description FROM " +
" AssetModels WHERE Model_Manuf_ID=@Manuf_ID ORDER By Model_Manuf_ID,Model_ID", connection);
adapter.SelectCommand.Parameters.AddWithValue("@Manuf_ID", Manuf_ID);
DataTable dt = new DataTable();
adapter.Fill(dt);
RadGrid2.DataSource = dt;
RadGrid2.DataBind();
}
}
}
please replay as soon as possible
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NewModels.aspx.cs" Inherits="TBS_HelpDesk.Views.Assets.NewModels"
MasterPageFile="~/Views/Shared/MasterPage.Master" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="aboutContent" ContentPlaceHolderID="MainContent" runat="server">
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" UpdatePanelHeight="" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadGrid runat="server" ID="RadGrid1" CellPadding="0" GridLines="None" AutoGenerateColumns="False"
AllowPaging="True" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemCommand="RadGrid1_ItemCommand">
<MasterTableView>
<Columns>
<telerik:GridBoundColumn DataField="Manuf_ID" DataType="System.Int32" HeaderText="Manuf ID"
SortExpression="Manuf_ID" UniqueName="Manuf_ID" Visible="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Manuf_Name" HeaderText="Manuf Name" SortExpression="Manuf_Name"
UniqueName="Manuf_Name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Manuf_Description" HeaderText="Manuf Description"
SortExpression="Manuf_Description" UniqueName="Manuf_Description">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings EnablePostBackOnRowClick="true">
<Selecting AllowRowSelect="True" />
</ClientSettings>
</telerik:RadGrid>
<telerik:RadGrid runat="server" ID="RadGrid2" CellPadding="0" GridLines="None" AutoGenerateColumns="False"
AllowPaging="True" Skin="WebBlue" OnItemCommand="RadGrid1_ItemCommand" OnNeedDataSource="RadGrid2_NeedDataSource">
<MasterTableView CommandItemDisplay="Top" EditFormSettings-PopUpSettings-Modal="true"
EditMode="PopUp">
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" />
<telerik:GridNumericColumn DataField="Model_ID" HeaderText="Model Id" SortExpression="Model_ID"
UniqueName="Model_ID" Visible="false" ReadOnly="true">
</telerik:GridNumericColumn>
<telerik:GridBoundColumn DataField="Model_Name" HeaderText="Model Name" SortExpression="Model_Name"
UniqueName="Model_Name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Model_Description" DataType="System.Boolean"
HeaderText="Model Description" SortExpression="Model_Description" UniqueName="Model_Description">
</telerik:GridBoundColumn>
<telerik:GridButtonColumn CommandName="Delete" ButtonType="ImageButton" UniqueName="DeleteColumn"
CommandArgument="Child" ConfirmDialogType="RadWindow" ConfirmText="Are You Sure Want To Delete This Record?"
ConfirmTitle="Delete Confirm" />
</Columns>
</MasterTableView>
</telerik:RadGrid>
</asp:Content>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.IO;
using Telerik.Web.UI;
using System.Data.SqlClient;
using System.Configuration;
namespace TBS_HelpDesk.Views.Assets
{
public partial class NewModels : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//if (!IsPostBack)
//{
// LoadManufacturers();
//}
}
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
DataTable dtTable = new DataTable();
string conn = ConfigurationManager.ConnectionStrings["TBSHelpDeskLiveDB_ConnectionString"].ToString();
SqlDataAdapter sqladp = new SqlDataAdapter();
SqlConnection sqlconn = new SqlConnection(conn);
sqlconn.Open();
try
{
string selectQuery = "SELECT Manuf_ID,Manuf_Name,Manuf_Description FROM [AssetManufacturers] order by Manuf_ID asc";
sqladp.SelectCommand = new SqlCommand(selectQuery, sqlconn);
sqladp.Fill(dtTable);
RadGrid1.DataSource = dtTable;
}
finally
{
sqlconn.Close();
}
}
protected void RadGrid2_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
SqlConnection connection = new SqlConnection(
ConfigurationManager.ConnectionStrings["TBSHelpDeskLiveDB_ConnectionString"].ConnectionString);
SqlDataAdapter adapter = new SqlDataAdapter("SELECT Model_ID,Model_Name,Model_Description FROM " +
" AssetModels WHERE Model_Manuf_ID = ", connection);
DataTable dt = new DataTable();
adapter.Fill(dt);
RadGrid2.DataSource = dt;
}
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == "RowClick")
{
GridDataItem item = (GridDataItem)e.Item;
string Manuf_ID = item["Manuf_ID"].Text;
LoadModels(Manuf_ID);
}
}
protected void LoadModels(string Manuf_ID)
{
SqlConnection connection = new SqlConnection(
ConfigurationManager.ConnectionStrings["TBSHelpDeskLiveDB_ConnectionString"].ConnectionString);
SqlDataAdapter adapter = new SqlDataAdapter("SELECT Model_ID,Model_Name,Model_Description FROM " +
" AssetModels WHERE Model_Manuf_ID=@Manuf_ID ORDER By Model_Manuf_ID,Model_ID", connection);
adapter.SelectCommand.Parameters.AddWithValue("@Manuf_ID", Manuf_ID);
DataTable dt = new DataTable();
adapter.Fill(dt);
RadGrid2.DataSource = dt;
RadGrid2.DataBind();
}
}
}
22 Answers, 1 is accepted
0

Elliott
Top achievements
Rank 2
answered on 20 Apr 2011, 08:45 PM
you could do it a couple of ways-create a hidden variable and set it as a UpdatedControl
I am not sure if you need to add it to both - almost certainly to RADGrid2
I am not sure if you need to add it to both - almost certainly to RADGrid2
0

mohamed
Top achievements
Rank 1
answered on 21 Apr 2011, 05:03 AM
i change this code pls check't
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NewModels.aspx.cs" Inherits="TBS_HelpDesk.Views.Assets.NewModels"
MasterPageFile="~/Views/Shared/MasterPage.Master" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="aboutContent" ContentPlaceHolderID="MainContent" runat="server">
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" UpdatePanelHeight="" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadGrid runat="server" ID="RadGrid1" CellPadding="0" GridLines="None" AutoGenerateColumns="False"
AllowPaging="True" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemCommand="RadGrid1_ItemCommand">
<MasterTableView>
<Columns>
<telerik:GridBoundColumn DataField="Manuf_ID" DataType="System.Int32" HeaderText="Manuf ID"
SortExpression="Manuf_ID" UniqueName="Manuf_ID" Visible="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Manuf_Name" HeaderText="Manuf Name" SortExpression="Manuf_Name"
UniqueName="Manuf_Name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Manuf_Description" HeaderText="Manuf Description"
SortExpression="Manuf_Description" UniqueName="Manuf_Description">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings EnablePostBackOnRowClick="true">
<Selecting AllowRowSelect="True" />
</ClientSettings>
</telerik:RadGrid>
<telerik:RadGrid runat="server" ID="RadGrid2" CellPadding="0" GridLines="None" AutoGenerateColumns="False"
AllowPaging="True" Skin="WebBlue" OnItemCommand="RadGrid1_ItemCommand" OnNeedDataSource="RadGrid2_NeedDataSource">
<MasterTableView CommandItemDisplay="Top" EditFormSettings-PopUpSettings-Modal="true"
EditMode="PopUp">
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" />
<telerik:GridNumericColumn DataField="Model_ID" HeaderText="Model Id" SortExpression="Model_ID"
UniqueName="Model_ID" Visible="false" ReadOnly="true">
</telerik:GridNumericColumn>
<telerik:GridBoundColumn DataField="Model_Name" HeaderText="Model Name" SortExpression="Model_Name"
UniqueName="Model_Name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Model_Description" DataType="System.Boolean"
HeaderText="Model Description" SortExpression="Model_Description" UniqueName="Model_Description">
</telerik:GridBoundColumn>
<telerik:GridButtonColumn CommandName="Delete" ButtonType="ImageButton" UniqueName="DeleteColumn"
CommandArgument="Child" ConfirmDialogType="RadWindow" ConfirmText="Are You Sure Want To Delete This Record?"
ConfirmTitle="Delete Confirm" />
</Columns>
</MasterTableView>
</telerik:RadGrid>
</asp:Content>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.IO;
using Telerik.Web.UI;
using System.Data.SqlClient;
using System.Configuration;
namespace TBS_HelpDesk.Views.Assets
{
public partial class NewModels : System.Web.UI.Page
{
public string Manuf_ID;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Manuf_ID = "0";
}
}
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
DataTable dtTable = new DataTable();
string conn = ConfigurationManager.ConnectionStrings["TBSHelpDeskLiveDB_ConnectionString"].ToString();
SqlDataAdapter sqladp = new SqlDataAdapter();
SqlConnection sqlconn = new SqlConnection(conn);
sqlconn.Open();
try
{
string selectQuery = "SELECT Manuf_ID,Manuf_Name,Manuf_Description FROM [AssetManufacturers] order by Manuf_ID asc";
sqladp.SelectCommand = new SqlCommand(selectQuery, sqlconn);
sqladp.Fill(dtTable);
RadGrid1.DataSource = dtTable;
}
finally
{
sqlconn.Close();
}
}
protected void RadGrid2_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
SqlConnection connection = new SqlConnection(
ConfigurationManager.ConnectionStrings["TBSHelpDeskLiveDB_ConnectionString"].ConnectionString);
SqlDataAdapter adapter = new SqlDataAdapter("SELECT Model_ID,Model_Name,Model_Description FROM " +
" AssetModels WHERE Model_Manuf_ID = " + Manuf_ID, connection);
DataTable dt = new DataTable();
adapter.Fill(dt);
RadGrid2.DataSource = dt;
}
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == "RowClick")
{
GridDataItem item = (GridDataItem)e.Item;
Manuf_ID = item["Manuf_ID"].Text;
RadGrid2.DataSource = null;
RadGrid2.Rebind();
}
}
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NewModels.aspx.cs" Inherits="TBS_HelpDesk.Views.Assets.NewModels"
MasterPageFile="~/Views/Shared/MasterPage.Master" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="aboutContent" ContentPlaceHolderID="MainContent" runat="server">
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" UpdatePanelHeight="" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadGrid runat="server" ID="RadGrid1" CellPadding="0" GridLines="None" AutoGenerateColumns="False"
AllowPaging="True" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemCommand="RadGrid1_ItemCommand">
<MasterTableView>
<Columns>
<telerik:GridBoundColumn DataField="Manuf_ID" DataType="System.Int32" HeaderText="Manuf ID"
SortExpression="Manuf_ID" UniqueName="Manuf_ID" Visible="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Manuf_Name" HeaderText="Manuf Name" SortExpression="Manuf_Name"
UniqueName="Manuf_Name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Manuf_Description" HeaderText="Manuf Description"
SortExpression="Manuf_Description" UniqueName="Manuf_Description">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings EnablePostBackOnRowClick="true">
<Selecting AllowRowSelect="True" />
</ClientSettings>
</telerik:RadGrid>
<telerik:RadGrid runat="server" ID="RadGrid2" CellPadding="0" GridLines="None" AutoGenerateColumns="False"
AllowPaging="True" Skin="WebBlue" OnItemCommand="RadGrid1_ItemCommand" OnNeedDataSource="RadGrid2_NeedDataSource">
<MasterTableView CommandItemDisplay="Top" EditFormSettings-PopUpSettings-Modal="true"
EditMode="PopUp">
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" />
<telerik:GridNumericColumn DataField="Model_ID" HeaderText="Model Id" SortExpression="Model_ID"
UniqueName="Model_ID" Visible="false" ReadOnly="true">
</telerik:GridNumericColumn>
<telerik:GridBoundColumn DataField="Model_Name" HeaderText="Model Name" SortExpression="Model_Name"
UniqueName="Model_Name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Model_Description" DataType="System.Boolean"
HeaderText="Model Description" SortExpression="Model_Description" UniqueName="Model_Description">
</telerik:GridBoundColumn>
<telerik:GridButtonColumn CommandName="Delete" ButtonType="ImageButton" UniqueName="DeleteColumn"
CommandArgument="Child" ConfirmDialogType="RadWindow" ConfirmText="Are You Sure Want To Delete This Record?"
ConfirmTitle="Delete Confirm" />
</Columns>
</MasterTableView>
</telerik:RadGrid>
</asp:Content>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.IO;
using Telerik.Web.UI;
using System.Data.SqlClient;
using System.Configuration;
namespace TBS_HelpDesk.Views.Assets
{
public partial class NewModels : System.Web.UI.Page
{
public string Manuf_ID;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Manuf_ID = "0";
}
}
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
DataTable dtTable = new DataTable();
string conn = ConfigurationManager.ConnectionStrings["TBSHelpDeskLiveDB_ConnectionString"].ToString();
SqlDataAdapter sqladp = new SqlDataAdapter();
SqlConnection sqlconn = new SqlConnection(conn);
sqlconn.Open();
try
{
string selectQuery = "SELECT Manuf_ID,Manuf_Name,Manuf_Description FROM [AssetManufacturers] order by Manuf_ID asc";
sqladp.SelectCommand = new SqlCommand(selectQuery, sqlconn);
sqladp.Fill(dtTable);
RadGrid1.DataSource = dtTable;
}
finally
{
sqlconn.Close();
}
}
protected void RadGrid2_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
SqlConnection connection = new SqlConnection(
ConfigurationManager.ConnectionStrings["TBSHelpDeskLiveDB_ConnectionString"].ConnectionString);
SqlDataAdapter adapter = new SqlDataAdapter("SELECT Model_ID,Model_Name,Model_Description FROM " +
" AssetModels WHERE Model_Manuf_ID = " + Manuf_ID, connection);
DataTable dt = new DataTable();
adapter.Fill(dt);
RadGrid2.DataSource = dt;
}
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == "RowClick")
{
GridDataItem item = (GridDataItem)e.Item;
Manuf_ID = item["Manuf_ID"].Text;
RadGrid2.DataSource = null;
RadGrid2.Rebind();
}
}
}
}
0

Elliott
Top achievements
Rank 2
answered on 21 Apr 2011, 01:12 PM
<
telerik:RadAjaxManager
ID
=
"raManager"
OnAjaxRequest
=
"raManager_AjaxRequest"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"rgAddItems"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"lblDealerNumber"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"rgAddItems"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"lblErrorMessage"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
Protected
Sub
rgAddItems_ItemCommand(
ByVal
source
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridCommandEventArgs)
Handles
rgAddItems.ItemCommand
Dim
PartNumberID
As
Integer
LastCommand = e.CommandName
Select
Case
e.CommandName
Case
"Edit"
rgAddItems.MasterTableView.IsItemInserted =
False
Case
"Update"
UpdateItem(
DirectCast
(e.Item, GridEditFormItem))
Case
"PerformInsert"
PartNumberID = AddPartNumber(
DirectCast
(e.Item, GridEditFormInsertItem))
Case
"Delete"
DeleteItem(e.Item)
End
Select
End
Sub
Private
Function
AddPartNumber(
ByVal
gefiItem
As
GridEditFormInsertItem)
As
Integer
Dim
PartNumberID, ItemID, Qty
As
Integer
Dim
tcPartNumber, tcQty
As
TableCell
Dim
txtPartNumber
As
TextBox
Dim
rntbQty
As
RadNumericTextBox
Dim
PartNumber
As
String
Dim
DealerNumber
As
Int64
If
Page.IsValid
Then
Else
Return
0
End
If
DealerNumber =
CType
(lblDealerNumber.Text, Int64)
tcPartNumber = gefiItem.Cells(0)
txtPartNumber =
DirectCast
(tcPartNumber.FindControl(
"txtPartNumber"
), TextBox)
PartNumber = txtPartNumber.Text.Trim()
ItemID = GetItemID(PartNumber)
lblErrorMessage.Text =
String
.Empty
If
ItemID = 0
Then
lblErrorMessage.Text =
"Part Number not on the Book"
Return
0
End
If
tcQty = gefiItem.Cells(1)
rntbQty =
DirectCast
(tcQty.FindControl(
"rntbQty"
), RadNumericTextBox)
If
rntbQty
Is
Nothing
Then
Return
PartNumberID
End
If
Qty =
CInt
(rntbQty.Value)
Dim
ws
As
New
CommonFunctions
PartNumberID = ws.InsertPartNumber(DealerNumber, ItemID, PartNumber, Qty)
ws =
Nothing
Return
PartNumberID
End
Function
you need to declare a variable (hidden or as in my case visible label) and add it to both grid's AJAX Settings
make sure you know the order of the events first
0

mohamed
Top achievements
Rank 1
answered on 21 Apr 2011, 01:29 PM
shall you possible send c# coding
0

Elliott
Top achievements
Rank 2
answered on 21 Apr 2011, 03:14 PM
no can do-sorry
I took an example from a production site-and we do all our development in VB.NET
it's the HTML you need to set up anyway
I took an example from a production site-and we do all our development in VB.NET
it's the HTML you need to set up anyway
0

Jayesh Goyani
Top achievements
Rank 2
answered on 22 Apr 2011, 06:03 AM
hi mohamed,
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" />
<telerik:AjaxUpdatedControl ControlID="RadGrid2" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
private string Manuf_ID
{
set
{
ViewState["Manuf_ID"] = value;
}
get
{
if (ViewState["Manuf_ID"] == null)
return "0";
else
return Convert.ToString(ViewState["Manuf_ID"]);
}
}
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == "RowClick")
{
GridDataItem item = (GridDataItem)e.Item;
Manuf_ID = item["Manuf_ID"].Text;
RadGrid2.Rebind();
}
}
Thanks,
Jayesh Goyani
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" />
<telerik:AjaxUpdatedControl ControlID="RadGrid2" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
private string Manuf_ID
{
set
{
ViewState["Manuf_ID"] = value;
}
get
{
if (ViewState["Manuf_ID"] == null)
return "0";
else
return Convert.ToString(ViewState["Manuf_ID"]);
}
}
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == "RowClick")
{
GridDataItem item = (GridDataItem)e.Item;
Manuf_ID = item["Manuf_ID"].Text;
RadGrid2.Rebind();
}
}
Thanks,
Jayesh Goyani
0

mohamed
Top achievements
Rank 1
answered on 22 Apr 2011, 10:06 AM
hello Jayesh Goyani,
thanks for ur reply .
bind in datatable
but i never assign the value in second grid
thanks for ur reply .
bind in datatable
but i never assign the value in second grid
0

Jayesh Goyani
Top achievements
Rank 2
answered on 23 Apr 2011, 06:24 AM
Hi mohamed
,
please explain in detail what your actual requirement.
Thanks,
Jayesh Goyani
please explain in detail what your actual requirement.
Thanks,
Jayesh Goyani
0

mohamed
Top achievements
Rank 1
answered on 23 Apr 2011, 06:28 AM
what i select that in first radgrid
that't assigned in second radgrid
that't assigned in second radgrid
0

mohamed
Top achievements
Rank 1
answered on 23 Apr 2011, 06:29 AM
protected void RadGrid2_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
SqlConnection connection = new SqlConnection(
ConfigurationManager.ConnectionStrings["TBSHelpDeskLiveDB_ConnectionString"].ConnectionString);
SqlDataAdapter adapter = new SqlDataAdapter("SELECT Model_ID,Model_Name,Model_Description FROM " +
" AssetModels WHERE Model_Manuf_ID = '" + Manuf_ID + "' ", connection);
DataTable dt = new DataTable();
adapter.Fill(dt);
RadGrid2.DataSource = dt;
}
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == "RowClick")
{
GridDataItem item = (GridDataItem)e.Item;
Manuf_ID = item["Manuf_ID"].Text;
item.Edit = true;
RadGrid2.Rebind();
//LoadModels(Manuf_ID);
}
}
NeedDataSource fire but not assign in second grid
{
SqlConnection connection = new SqlConnection(
ConfigurationManager.ConnectionStrings["TBSHelpDeskLiveDB_ConnectionString"].ConnectionString);
SqlDataAdapter adapter = new SqlDataAdapter("SELECT Model_ID,Model_Name,Model_Description FROM " +
" AssetModels WHERE Model_Manuf_ID = '" + Manuf_ID + "' ", connection);
DataTable dt = new DataTable();
adapter.Fill(dt);
RadGrid2.DataSource = dt;
}
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == "RowClick")
{
GridDataItem item = (GridDataItem)e.Item;
Manuf_ID = item["Manuf_ID"].Text;
item.Edit = true;
RadGrid2.Rebind();
//LoadModels(Manuf_ID);
}
}
NeedDataSource fire but not assign in second grid
0

mohamed
Top achievements
Rank 1
answered on 23 Apr 2011, 06:50 AM
Hello Jayesh Goyani
pls reply as soon as possible ,
it's urgent
pls reply as soon as possible ,
it's urgent
0

Jayesh Goyani
Top achievements
Rank 2
answered on 23 Apr 2011, 06:51 AM
Hi
Remove RadAjaxManager from your page so we can identify the actual problem.
Thanks,
Jayesh Goyani
Remove RadAjaxManager from your page so we can identify the actual problem.
Thanks,
Jayesh Goyani
0

mohamed
Top achievements
Rank 1
answered on 23 Apr 2011, 06:55 AM
Afeter Remove RadAjaxManager .
assign properly
assign properly
Thanks Allot . Jayesh Goyani ,
0

mohamed
Top achievements
Rank 1
answered on 23 Apr 2011, 07:02 AM
another one doubt
When i click the ad new record .
assigned grid disabled
why's come
When i click the ad new record .
assigned grid disabled
why's come
0

Jayesh Goyani
Top achievements
Rank 2
answered on 23 Apr 2011, 07:13 AM
Hi mohamed,
plz send your aspx page's code so i will find actual problem.
Thanks,
Jayesh Goyani
plz send your aspx page's code so i will find actual problem.
Thanks,
Jayesh Goyani
0

mohamed
Top achievements
Rank 1
answered on 23 Apr 2011, 07:17 AM
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NewModels.aspx.cs" Inherits="TBS_HelpDesk.Views.Assets.NewModels"
MasterPageFile="~/Views/Shared/MasterPage.Master" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="aboutContent" ContentPlaceHolderID="MainContent" runat="server">
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" UpdatePanelHeight="" />
<telerik:AjaxUpdatedControl ControlID="RadGrid2" UpdatePanelHeight="" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadGrid runat="server" ID="RadGrid1" CellPadding="0" GridLines="None" AutoGenerateColumns="False"
AllowPaging="True" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemCommand="RadGrid1_ItemCommand">
<MasterTableView DataKeyNames="Manuf_ID">
<Columns>
<telerik:GridBoundColumn DataField="Manuf_ID" DataType="System.Int32" HeaderText="Manuf ID"
SortExpression="Manuf_ID" UniqueName="Manuf_ID" Visible="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Manuf_Name" HeaderText="Manuf Name" SortExpression="Manuf_Name"
UniqueName="Manuf_Name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Manuf_Description" HeaderText="Manuf Description"
SortExpression="Manuf_Description" UniqueName="Manuf_Description">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings EnablePostBackOnRowClick="true">
<Selecting AllowRowSelect="True" />
</ClientSettings>
</telerik:RadGrid>
<telerik:RadGrid runat="server" ID="RadGrid2" CellPadding="0" GridLines="None" AutoGenerateColumns="False"
AllowPaging="True" Skin="WebBlue"
OnNeedDataSource="RadGrid2_NeedDataSource" onitemcommand="RadGrid2_ItemCommand">
<MasterTableView CommandItemDisplay="Top" EditFormSettings-PopUpSettings-Modal="true"
EditMode="PopUp">
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" />
<telerik:GridNumericColumn DataField="Model_ID" HeaderText="Model Id" SortExpression="Model_ID"
UniqueName="Model_ID" Visible="false" ReadOnly="true">
</telerik:GridNumericColumn>
<telerik:GridBoundColumn DataField="Model_Name" HeaderText="Model Name" SortExpression="Model_Name"
UniqueName="Model_Name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Model_Description" DataType="System.Boolean"
HeaderText="Model Description" SortExpression="Model_Description" UniqueName="Model_Description">
</telerik:GridBoundColumn>
<telerik:GridButtonColumn CommandName="Delete" ButtonType="ImageButton" UniqueName="DeleteColumn"
CommandArgument="Child" ConfirmDialogType="RadWindow" ConfirmText="Are You Sure Want To Delete This Record?"
ConfirmTitle="Delete Confirm" />
</Columns>
</MasterTableView>
<ClientSettings EnablePostBackOnRowClick="true">
<Selecting AllowRowSelect="True" />
</ClientSettings>
</telerik:RadGrid>
</asp:Content>
MasterPageFile="~/Views/Shared/MasterPage.Master" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="aboutContent" ContentPlaceHolderID="MainContent" runat="server">
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" UpdatePanelHeight="" />
<telerik:AjaxUpdatedControl ControlID="RadGrid2" UpdatePanelHeight="" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadGrid runat="server" ID="RadGrid1" CellPadding="0" GridLines="None" AutoGenerateColumns="False"
AllowPaging="True" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemCommand="RadGrid1_ItemCommand">
<MasterTableView DataKeyNames="Manuf_ID">
<Columns>
<telerik:GridBoundColumn DataField="Manuf_ID" DataType="System.Int32" HeaderText="Manuf ID"
SortExpression="Manuf_ID" UniqueName="Manuf_ID" Visible="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Manuf_Name" HeaderText="Manuf Name" SortExpression="Manuf_Name"
UniqueName="Manuf_Name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Manuf_Description" HeaderText="Manuf Description"
SortExpression="Manuf_Description" UniqueName="Manuf_Description">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings EnablePostBackOnRowClick="true">
<Selecting AllowRowSelect="True" />
</ClientSettings>
</telerik:RadGrid>
<telerik:RadGrid runat="server" ID="RadGrid2" CellPadding="0" GridLines="None" AutoGenerateColumns="False"
AllowPaging="True" Skin="WebBlue"
OnNeedDataSource="RadGrid2_NeedDataSource" onitemcommand="RadGrid2_ItemCommand">
<MasterTableView CommandItemDisplay="Top" EditFormSettings-PopUpSettings-Modal="true"
EditMode="PopUp">
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" />
<telerik:GridNumericColumn DataField="Model_ID" HeaderText="Model Id" SortExpression="Model_ID"
UniqueName="Model_ID" Visible="false" ReadOnly="true">
</telerik:GridNumericColumn>
<telerik:GridBoundColumn DataField="Model_Name" HeaderText="Model Name" SortExpression="Model_Name"
UniqueName="Model_Name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Model_Description" DataType="System.Boolean"
HeaderText="Model Description" SortExpression="Model_Description" UniqueName="Model_Description">
</telerik:GridBoundColumn>
<telerik:GridButtonColumn CommandName="Delete" ButtonType="ImageButton" UniqueName="DeleteColumn"
CommandArgument="Child" ConfirmDialogType="RadWindow" ConfirmText="Are You Sure Want To Delete This Record?"
ConfirmTitle="Delete Confirm" />
</Columns>
</MasterTableView>
<ClientSettings EnablePostBackOnRowClick="true">
<Selecting AllowRowSelect="True" />
</ClientSettings>
</telerik:RadGrid>
</asp:Content>
0
Accepted

Jayesh Goyani
Top achievements
Rank 2
answered on 23 Apr 2011, 07:26 AM
Hi
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" UpdatePanelHeight="" />
<telerik:AjaxUpdatedControl ControlID="RadGrid2" UpdatePanelHeight="" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="RadGrid2">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid2" UpdatePanelHeight="" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
plz replace your ajaxmanager with above.
Thanks,
Jayesh Goyani
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" UpdatePanelHeight="" />
<telerik:AjaxUpdatedControl ControlID="RadGrid2" UpdatePanelHeight="" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="RadGrid2">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid2" UpdatePanelHeight="" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
plz replace your ajaxmanager with above.
Thanks,
Jayesh Goyani
0

mohamed
Top achievements
Rank 1
answered on 23 Apr 2011, 07:32 AM
Thanks For Ur Reply,
nothing change
same result
any other ways
it's urgent
pls reply as soon as possible
weekend demo
regards
Mohamed
nothing change
same result
any other ways
it's urgent
pls reply as soon as possible
weekend demo
regards
Mohamed
0

Jayesh Goyani
Top achievements
Rank 2
answered on 23 Apr 2011, 09:12 AM
hi
there is not any issue in your aspx page's code.
plz check your aspx.cs file code and let me know if u still not able to resolve this problem.
Thanks,
Jayesh Goyani
there is not any issue in your aspx page's code.
plz check your aspx.cs file code and let me know if u still not able to resolve this problem.
Thanks,
Jayesh Goyani
0

mohamed
Top achievements
Rank 1
answered on 23 Apr 2011, 09:26 AM
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.IO;
using Telerik.Web.UI;
using System.Data.SqlClient;
using System.Configuration;
namespace TBS_HelpDesk.Views.Assets
{
public partial class NewModels : System.Web.UI.Page
{
public string Manuf_ID;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Manuf_ID = "0";
}
}
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
DataTable dtTable = new DataTable();
string conn = ConfigurationManager.ConnectionStrings["TBSHelpDeskLiveDB_ConnectionString"].ToString();
SqlDataAdapter sqladp = new SqlDataAdapter();
SqlConnection sqlconn = new SqlConnection(conn);
sqlconn.Open();
try
{
string selectQuery = "SELECT Manuf_ID,Manuf_Name,Manuf_Description FROM [AssetManufacturers] order by Manuf_ID asc";
sqladp.SelectCommand = new SqlCommand(selectQuery, sqlconn);
sqladp.Fill(dtTable);
RadGrid1.DataSource = dtTable;
}
finally
{
sqlconn.Close();
}
}
protected void RadGrid2_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
SqlConnection connection = new SqlConnection(
ConfigurationManager.ConnectionStrings["TBSHelpDeskLiveDB_ConnectionString"].ConnectionString);
SqlDataAdapter adapter = new SqlDataAdapter("SELECT Model_ID,Model_Name,Model_Description FROM " +
" AssetModels WHERE Model_Manuf_ID = '" + Manuf_ID + "' ", connection);
DataTable dt = new DataTable();
adapter.Fill(dt);
RadGrid2.DataSource = dt;
}
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == "RowClick")
{
GridDataItem item = (GridDataItem)e.Item;
Manuf_ID = item["Manuf_ID"].Text;
RadGrid2.DataSource = null;
RadGrid2.Rebind();
}
}
protected void RadGrid2_ItemCommand(object sender, GridCommandEventArgs e)
{
SqlConnection connection = new SqlConnection(
ConfigurationManager.ConnectionStrings["TBSHelpDeskLiveDB_ConnectionString"].ConnectionString);
DataTable dtTable = new DataTable();
string conn = ConfigurationManager.ConnectionStrings["TBSHelpDeskLiveDB_ConnectionString"].ToString();
SqlDataAdapter sqladp = new SqlDataAdapter();
SqlConnection sqlconn = new SqlConnection(conn);
SqlCommand sqlcmd = new SqlCommand();
if (e.CommandName == RadGrid.PerformInsertCommandName)
{
GridEditFormInsertItem insertedItem = (GridEditFormInsertItem)e.Item;
RadNumericTextBox Model_ID = (e.Item as GridEditFormInsertItem)["Model_ID"].Controls[0] as RadNumericTextBox;
TextBox Model_Name = (e.Item as GridEditFormInsertItem)["Model_Name"].Controls[0] as TextBox;
TextBox Model_Description = (e.Item as GridEditFormInsertItem)["Model_Description"].Controls[0] as TextBox;
try
{
sqlconn.Open();
string insertQuery = "INSERT INTO [AssetModels] ([Model_Manuf_ID],[Model_ID],[Model_Name], " +
" [Model_Description]) VALUES ('" + Manuf_ID + "',(SELECT isnull(MAX(MODEL_ID),0)+1 FROM ASSETMODELS WHERE MODEL_MANUF_ID='" + Manuf_ID + "'), " +
" '" + Model_Name.Text + "','" + Model_Description.Text + "')";
sqlcmd.CommandText = insertQuery;
sqlcmd.Connection = sqlconn;
sqlcmd.ExecuteNonQuery();
SqlDataAdapter adapter = new SqlDataAdapter("SELECT Model_ID,Model_Name,Model_Description FROM AssetModels WHERE Model_Manuf_ID=@Manuf_ID ORDER By Model_ID", connection);
adapter.SelectCommand.Parameters.AddWithValue("@Manuf_ID", Manuf_ID);
DataTable dt = new DataTable();
adapter.Fill(dt);
RadGrid2.DataSource = dt;
RadGrid2.DataBind();
}
catch (Exception ex)
{
RadGrid1.Controls.Add(new LiteralControl("Unable to insert Employee. Reason: " + ex.Message));
}
RadGrid1.MasterTableView.IsItemInserted = false;
RadGrid1.DataBind();
e.Canceled = true;
}
else if (e.CommandName == RadGrid.UpdateCommandName)
{
GridEditableItem editedItem = e.Item as GridEditableItem;
RadNumericTextBox Model_ID = (e.Item as GridEditableItem)["Model_ID"].Controls[0] as RadNumericTextBox;
TextBox Model_Name = (e.Item as GridEditableItem)["Model_Name"].Controls[0] as TextBox;
TextBox Model_Description = (e.Item as GridEditableItem)["Model_Description"].Controls[0] as TextBox;
try
{
sqlconn.Open();
string updateQuery = "UPDATE [AssetModels] SET [Model_Name] = '" + Model_Name.Text + "', " +
" [Model_Description] = '" + Model_Description.Text + "' WHERE [Model_ID] = '" + Model_ID.Text + "' AND " +
" [Model_Manuf_ID] = '" + Manuf_ID + "' ";
sqlcmd.CommandText = updateQuery;
sqlcmd.Connection = sqlconn;
sqlcmd.ExecuteNonQuery();
SqlDataAdapter adapter = new SqlDataAdapter("SELECT Model_Name,Model_Description FROM AssetModels WHERE Model_Manuf_ID=@Manuf_ID ORDER By Model_ID", connection);
adapter.SelectCommand.Parameters.AddWithValue("@Manuf_ID", Manuf_ID);
DataTable dt = new DataTable();
adapter.Fill(dt);
RadGrid2.DataSource = dt;
RadGrid2.DataBind();
sqlconn.Close();
}
catch (Exception ex)
{
RadGrid1.Controls.Add(new LiteralControl("Unable to update Employee. Reason: " + ex.Message));
}
RadGrid2.EditIndexes.Clear();
RadGrid2.DataBind();
e.Canceled = true;
}
else if (e.CommandName == RadGrid.DeleteCommandName)
{
GridDataItem item = (GridDataItem)e.Item;
string Model_ID = item["Model_ID"].Text;
try
{
sqlconn.Open();
string deleteQuery = "DELETE FROM [AssetModels] WHERE [Model_ID] ='" + Model_ID + "' and [Model_Manuf_ID] = '" + Manuf_ID + "' ";
sqlcmd.CommandText = deleteQuery;
sqlcmd.Connection = sqlconn;
sqlcmd.ExecuteNonQuery();
SqlDataAdapter adapter = new SqlDataAdapter("SELECT Model_Name,Model_Description FROM AssetModels WHERE Model_Manuf_ID=@Manuf_ID ORDER By Model_ID", connection);
adapter.SelectCommand.Parameters.AddWithValue("@Manuf_ID", Manuf_ID);
DataTable dt = new DataTable();
adapter.Fill(dt);
RadGrid2.DataSource = dt;
RadGrid2.DataBind();
sqlconn.Close();
}
catch (Exception ex)
{
RadGrid1.Controls.Add(new LiteralControl("Unable to delete Id. Reason: " + ex.Message));
e.Canceled = true;
}
}
}
}
}
0

Jayesh Goyani
Top achievements
Rank 2
answered on 23 Apr 2011, 09:39 AM
hi
Add new record not working b'coz of this code.
e.Canceled = true;
plz remove this code from event "RadGrid2_ItemCommand ".
also see below link
http://www.telerik.com/help/aspnet/grid/grdcommandsthatinvokerebindimplicitly.html
Thanks,
Jayesh Goyani
Add new record not working b'coz of this code.
e.Canceled = true;
plz remove this code from event "RadGrid2_ItemCommand ".
also see below link
http://www.telerik.com/help/aspnet/grid/grdcommandsthatinvokerebindimplicitly.html
Thanks,
Jayesh Goyani
0

mohamed
Top achievements
Rank 1
answered on 23 Apr 2011, 10:01 AM
thanks
Jayesh Goyani
Hi
Still I have Same Problem
No Difference.
any one help this problem
it's very urgent
Jayesh Goyani
Hi
Still I have Same Problem
No Difference.
any one help this problem
it's very urgent