Hi Experts,
I have a radGrid on my aspx page with some input controls.
In radGrid i have 2 columns one is GridEditCommandColumn for editing record and other is GridButtonColumn for deleting record. I also placed radAjaxPanel and radAjaxLoading panel. All input controls and grid resides under raAjaxPanel.
When I click edit button from grid it populates all the input controls and grid gets disappear. Similarly when i click delete button from grid it makes an ajax call like edit button does and disappears the grid.
Can anyone please help me out.
Thanks,
Mohsin
I have a radGrid on my aspx page with some input controls.
In radGrid i have 2 columns one is GridEditCommandColumn for editing record and other is GridButtonColumn for deleting record. I also placed radAjaxPanel and radAjaxLoading panel. All input controls and grid resides under raAjaxPanel.
When I click edit button from grid it populates all the input controls and grid gets disappear. Similarly when i click delete button from grid it makes an ajax call like edit button does and disappears the grid.
Can anyone please help me out.
Thanks,
Mohsin
5 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 07 Apr 2011, 12:57 PM
Hello Mohsin,
I guess you are binding the grid in PageLoad event, which is Simple data binding technique.Try binding the Grrd uding using "AdvancedData binding" using NeedDataSource event.
For more information about this can be available here.
-Shinu.
I guess you are binding the grid in PageLoad event, which is Simple data binding technique.Try binding the Grrd uding using "AdvancedData binding" using NeedDataSource event.
For more information about this can be available here.
-Shinu.
0
Mohsin
Top achievements
Rank 1
answered on 07 Apr 2011, 01:28 PM
Hi Shinu,
This works for me. But I have other problems as well.....first how can i add dropdown list dynamically and populate from database when press edit button? and how can I hide those fields that shows key fields(customerID, CountryID...etc).
Thanks,
Mohsin
This works for me. But I have other problems as well.....first how can i add dropdown list dynamically and populate from database when press edit button? and how can I hide those fields that shows key fields(customerID, CountryID...etc).
Thanks,
Mohsin
0
Accepted
Shinu
Top achievements
Rank 2
answered on 08 Apr 2011, 07:10 AM
Hello Moshin,
You can add the DropDown from the aspx itself.
One suggestion is to use GridDraopDownColumn which shown text in normal mode and DropDown in Edit mode.
aspx:
For your second query, you can set the property ReadOnly for the key field columns, that prevents the value from editing.
aspx:
Thanks,
Shinu.
You can add the DropDown from the aspx itself.
One suggestion is to use GridDraopDownColumn which shown text in normal mode and DropDown in Edit mode.
aspx:
<
telerik:GridDropDownColumn
DataSourceID
=
"SqlDataSource1"
DataField
=
"CustomerID"
HeaderText
=
"CustomerID"
ListTextField
=
"Region"
ListValueField
=
"CustomerID"
UniqueName
=
"CustomerID"
>
</
telerik:GridDropDownColumn
>
aspx:
<
telerik:GridBoundColumn
ReadOnly
=
"true"
DataField
=
"orderID"
HeaderText
=
"orderID"
SortExpression
=
"orderID"
UniqueName
=
"orderID"
>
Thanks,
Shinu.
0
Mohsin
Top achievements
Rank 1
answered on 09 Apr 2011, 12:46 PM
Hi Shinu,
Thanks for the prompt help. It really works for me.
I tried adding asp dropdown and populate from database it works and also i added griddropdowncolumn and bind that column from database but I uses the DataSourceID attribute that you mentioned in your reply. How can I achieve databinding without dataScoureID attribute????
Regards,
Mohsin
Thanks for the prompt help. It really works for me.
I tried adding asp dropdown and populate from database it works and also i added griddropdowncolumn and bind that column from database but I uses the DataSourceID attribute that you mentioned in your reply. How can I achieve databinding without dataScoureID attribute????
Regards,
Mohsin
0
Shinu
Top achievements
Rank 2
answered on 11 Apr 2011, 06:48 AM
Hello Mohsin,
One approach is to access the control from code behind and populate form there. Here is a sample code.
C#:
Thanks,
Shinu.
One approach is to access the control from code behind and populate form there. Here is a sample code.
C#:
protected
void
RadGrid1_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridEditFormItem && e.Item.IsInEditMode)
//Checks whether the grid is in edit mode.
{
GridEditFormItem editItem = (GridEditFormItem)e.Item;
RadComboBox Combo1= (RadComboBox)editItem[
"CustomerID"
].Controls[0];
CustomerID.DataSource =
//set the datasource here
}
}
Thanks,
Shinu.