Hi,
http://demos.telerik.com/aspnet-ajax/ajax/examples/manager/dynamicajaxsettings/defaultcs.aspx?product=grid
I saw the above link.
My Reruirement
Can i make the "Add new record" Button Disable/Hide while in the edit mode?
Thanks & Regards
Kannan
http://demos.telerik.com/aspnet-ajax/ajax/examples/manager/dynamicajaxsettings/defaultcs.aspx?product=grid
I saw the above link.
My Reruirement
Can i make the "Add new record" Button Disable/Hide while in the edit mode?
Thanks & Regards
Kannan
8 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 20 Dec 2010, 11:58 AM
Hello Kannan,
You could hide the Command Item in the PreRender event like below.
C#:
Regards,
Shinu.
You could hide the Command Item in the PreRender event like below.
C#:
protected
void
grdEmail_PreRender(
object
sender, EventArgs e)
{
if
(grdEmail.EditIndexes.Count > 0)
grdEmail.MasterTableView.CommandItemSettings.ShowAddNewRecordButton =
false
;
else
grdEmail.MasterTableView.CommandItemSettings.ShowAddNewRecordButton =
true
;
grdEmail.Rebind();
}
Regards,
Shinu.
0
Kannan
Top achievements
Rank 1
answered on 20 Dec 2010, 12:55 PM
Hi,
I used the code which you have posted. But i am getting an error that "does not contain the definition ShowAddNewRecordButton.
My dll version is 2008.1.515.35.
Please let me know whether we can do in this or not.
thanks & regards
kannan
I used the code which you have posted. But i am getting an error that "does not contain the definition ShowAddNewRecordButton.
My dll version is 2008.1.515.35.
Please let me know whether we can do in this or not.
thanks & regards
kannan
0
Shinu
Top achievements
Rank 2
answered on 21 Dec 2010, 06:18 AM
Hello Kannan,
The property ShowAddNewRecordButton is available from the version Q1 2010 BETA (version 2010.1.216). Since you are using the older version you can achieve the same by accessing the control and then setting the visibility to false. Here is the sample code.
C#:
-Shinu.
The property ShowAddNewRecordButton is available from the version Q1 2010 BETA (version 2010.1.216). Since you are using the older version you can achieve the same by accessing the control and then setting the visibility to false. Here is the sample code.
C#:
protected
void
RadGrid1_PreRender(
object
sender, EventArgs e)
{
if
(RadGrid1.EditIndexes.Count > 0)
{
GridCommandItem cmdItem=(GridCommandItem)RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)[0];
cmdItem.FindControl(
"InitInsertButton"
).Parent.Visible =
false
;
}
}
-Shinu.
0
Kannan
Top achievements
Rank 1
answered on 21 Dec 2010, 08:03 AM
Thanks Shinu,
The code which u have sent is working fine.
And now i have another query in GRID
1.I need some space between Insert Button and Cancel Button. Is it possible?
2.Is Excel export is available in the version which i am using (2008.1.515.35)
Thanks & Regards
Kannan
The code which u have sent is working fine.
And now i have another query in GRID
1.I need some space between Insert Button and Cancel Button. Is it possible?
2.Is Excel export is available in the version which i am using (2008.1.515.35)
Thanks & Regards
Kannan
0
Princy
Top achievements
Rank 2
answered on 21 Dec 2010, 02:10 PM
Hi Kannan,
One method is accessing the control from code and setting the style to get teh required appearance.
cs:
Give a try with this and see whether it helps.
And I believe the version supports exporting to excel. You can check that by using the code:
RadGrid1.MasterTableView.ExportToExcel();
Thanks,
Princy.
One method is accessing the control from code and setting the style to get teh required appearance.
cs:
protected
void
RadGrid1_PreRender(
object
sender, EventArgs e)
{
GridEditFormInsertItem inserItem = (GridEditFormInsertItem)RadGrid1.MasterTableView.GetInsertItem();
LinkButton lnkCancel =(LinkButton)inserItem.FindControl(
"CancelButton"
);
lnkCancel.Attributes.Add(
"Style"
,
"float: right !important;"
);
}
And I believe the version supports exporting to excel. You can check that by using the code:
RadGrid1.MasterTableView.ExportToExcel();
Thanks,
Princy.
0
Kannan
Top achievements
Rank 1
answered on 22 Dec 2010, 06:52 AM
Hi Princy,
Thanks for ur code. And in the mean time i found another solution for spacing
protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
LinkButton insertButton = (LinkButton)e.Item.FindControl("PerformInsertButton");
insertButton.Style["margin-right"] = "30px";
}
For Excel export is there any command item which is available in new version? Are can u give some sample codes for excel export?
Thanks & Regards
Kannan.S
Thanks for ur code. And in the mean time i found another solution for spacing
protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
LinkButton insertButton = (LinkButton)e.Item.FindControl("PerformInsertButton");
insertButton.Style["margin-right"] = "30px";
}
For Excel export is there any command item which is available in new version? Are can u give some sample codes for excel export?
Thanks & Regards
Kannan.S
0
Shinu
Top achievements
Rank 2
answered on 22 Dec 2010, 10:07 AM
Hello Kannan ,
TThe built-in command item buttons (like ShowExportToExcelButton, ShowExportToPdfButton etc) are available from the vesion 2009.3.1016.
In order to achieve the same functionality with your version, you could place Button control in CommandItemTemplate and set the CommandName as "ExportToExcel".
Thanks,
Shinu.
TThe built-in command item buttons (like ShowExportToExcelButton, ShowExportToPdfButton etc) are available from the vesion 2009.3.1016.
In order to achieve the same functionality with your version, you could place Button control in CommandItemTemplate and set the CommandName as "ExportToExcel".
<
CommandItemTemplate
>
<
asp:Button
ID
=
"Button2"
runat
=
"server"
Text
=
"Button"
CommandName
=
"ExportToExcel"
/>
</
CommandItemTemplate
>
Thanks,
Shinu.
0
Kannan
Top achievements
Rank 1
answered on 22 Dec 2010, 11:13 AM
Hi Shinu.
Thank you thanks a lot for ur support
Thank you thanks a lot for ur support