Selvamanikandan
Top achievements
Rank 1
Selvamanikandan
asked on 17 Jun 2013, 09:33 AM
When i'm trying to bind a record from one grid view to another grid view using item command event i'm facing the following error.
"Object Doesn't support this action". please help me regarding this.
"Object Doesn't support this action". please help me regarding this.
4 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 17 Jun 2013, 10:50 AM
Hi,
I tried to bind a record from one RadGrid to another and it worked as expected. Here is the sample code.
C#:
Thanks,
Shinu.
I tried to bind a record from one RadGrid to another and it worked as expected. Here is the sample code.
C#:
protected
void
RadGrid1_ItemCommand(
object
sender, GridCommandEventArgs e)
{
if
(e.CommandName == RadGrid.SelectCommandName && e.Item
is
GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
DataTable dt1 = (DataTable)Session[
"dt"
];
//first grid datasource
DataTable dt = dt1.Clone();
DataRow dr = dt.NewRow();
dr[
"CustomerID"
] = item[
"CustomerID"
].Text;
dr[
"ContactName"
] = item[
"ContactName"
].Text;
dr[
"City"
] = item[
"City"
].Text;
dt.Rows.Add(dr);
radgrid2.DataSource = dt;
radgrid2.DataBind();
}
}
Thanks,
Shinu.
0
Selvamanikandan
Top achievements
Rank 1
answered on 18 Jun 2013, 05:09 AM
Microsoft JScript runtime error: Unable to set value of the property 'control': object is null or undefined. i'm getting the below error while adding items to one radgrid to another radgrid. kindly help me.
0
Princy
Top achievements
Rank 2
answered on 21 Jun 2013, 09:29 AM
Hi,
Unfortunately I couldn't replicate the issue at my end. Here is the complete Code snippet I tried.
ASPX:
C#:
Thanks,
Princy.
Unfortunately I couldn't replicate the issue at my end. Here is the complete Code snippet I tried.
ASPX:
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AutoGenerateColumns
=
"false"
OnItemCommand
=
"RadGrid1_ItemCommand"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
>
<
MasterTableView
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"OrderID"
>
</
telerik:GridBoundColumn
>
<
telerik:GridButtonColumn
CommandName
=
"Select"
Text
=
"select"
>
</
telerik:GridButtonColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
<
br
/>
<
telerik:RadGrid
ID
=
"RadGrid2"
runat
=
"server"
AutoGenerateColumns
=
"false"
>
<
MasterTableView
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"OrderID"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
C#:
public
static
string
connection = WebConfigurationManager.ConnectionStrings[
"NorthwindConnectionString3"
].ConnectionString;
SqlConnection conn =
new
SqlConnection(connection);
public
SqlCommand SqlCommand =
new
SqlCommand();
protected
void
RadGrid1_NeedDataSource(
object
sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
string
selectQuery1 =
"select top 10 OrderID from Orders"
;
SqlDataAdapter adapter1 =
new
SqlDataAdapter(selectQuery1, conn);
conn.Open();
DataTable dt =
new
DataTable();
adapter1.Fill(dt);
conn.Close();
Session[
"dt"
] = dt;
RadGrid1.DataSource = dt;
}
protected
void
RadGrid1_ItemCommand(
object
sender, Telerik.Web.UI.GridCommandEventArgs e)
{
if
(e.CommandName == RadGrid.SelectCommandName && e.Item
is
GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
DataTable dt1 = (DataTable)Session[
"dt"
];
DataTable dt = dt1.Clone();
DataRow dr = dt.NewRow();
dr[
"OrderID"
] = item[
"OrderID"
].Text;
dt.Rows.Add(dr);
RadGrid2.DataSource = dt;
RadGrid2.DataBind();
}
}
Thanks,
Princy.
0
Selvamanikandan
Top achievements
Rank 1
answered on 21 Jun 2013, 12:04 PM
Thanks Princy..finally i found out the error its becuase of i've set one control as visible="false" and tried to get the value from that control so javascript error occured. thanks for ur reply.