I have a radgrid in which I have added an image button to the header in the code behind. Here is where I am adding the button:
protected
void
RadGridMain_ItemCreated(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridHeaderItem)
{
GridHeaderItem headerItem = (GridHeaderItem)e.Item;
GridTableView table = headerItem.OwnerTableView;
GridColumn column = table.GetColumnSafe(
"AddTeamPositionColumn"
);
if
(column !=
null
)
{
ImageButton addTeam =
new
ImageButton();
addTeam.ID =
"btnAddTeam"
;
addTeam.ImageUrl =
"~/Images/Volunteer/AddPos.png"
;
addTeam.ToolTip =
"Add new team"
;
headerItem[
"AddTeamPositionColumn"
].Controls.Add(addTeam);
addTeam.CommandName =
"initInsert"
;
headerItem.Style[
"vertical-align"
] =
"middle"
;
}
}
}
This works fine, but in firefox and chrome the button appears at the very bottom of the header with blank space above it (pls see attached images). It looks fine in IE. I have tried all sorts of things to effect the alignment and nothing has any effect at all. Here is the html of the column:
<
telerik:GridButtonColumn
ButtonType
=
"ImageButton"
ItemStyle-Wrap
=
"true"
CommandName
=
"addNestedItem"
Text
=
"Add new team position"
ImageUrl
=
"~/Images/Volunteer/AddPos.png"
ButtonCssClass
=
"MyImageButton"
UniqueName
=
"AddTeamPositionColumn"
>
<
HeaderStyle
Width
=
"25px"
VerticalAlign
=
"Middle"
></
HeaderStyle
>
<
ItemStyle
HorizontalAlign
=
"Center"
VerticalAlign
=
"Middle"
CssClass
=
"MyImageButton"
></
ItemStyle
>
</
telerik:GridButtonColumn
>
Does anyone know what I can do to make the image button added in the code behind be centered?
Hi,
I understand that there is no RadLabel control? I have read (and used) some of the workarounds for using ASP:Label eg, using RadFormDecorator to style labels, Setting visibility in pre-render for multi-pages.
It just seems that every time I use an asp label I have trouble eg. my current problem is that ASP:Labels do not display on RadWizard Steps.
I was wondering what the reason is for having no RadLabel as surely this is a basic control for you guys to create (compared to other more fancy controls)?
Hi,
I search a lot but I don't find a way to "disable" the click event on a legend of a chart. I don't want my user could click on the legend.
Could you please help me ?
Thank
Hello,
I have a tabstrip that is dynamically created based on values in a table in a database. There are several child tabs as well (up to three levels). When I click on a tab a web user control is dynamically loaded into the RadMultiPage. One of these web user controls contains a RadGrid that has a button column. When the user clicks this button I want to switch to a new tab and I'd like to do this from code-behind. Is this possible? If it is, how?
Thanks.
hi,
i try to get my imagegallery same pic wich in folder's name
ImageGallerr.ImagesFolderPath="Image/"
image is the name of my foder but it not work and whene i make the same url in propertie it work
plz i need help very quickly
So, I've got a grid configured as such
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.PageSize(250)
.Read(read => read.Action("_readData", "Data", new { Id= Model.Id })))
.Scrollable(scrolling => scrolling.Enabled(true))
.Sortable()
.Pageable(paging => paging.Enabled(true)
.PageSizes(false)
.Input(false)
.Info(true)
.Numeric(false)
.PreviousNext(false)
.Messages(m => m.Display("Total Records: {2}")))
In the _readData() method of my controller, all data is retrieved and returned and the Total Records displayed reflects that.
var data = ReadData();
DataSourceResult result = data.ToDataSourceResult(request);
return Json(result);
However, the grid itself only displays 250 (the PageSize) items, even though all the items were returned, and nothing else gets displayed.
If I set Virtual(true) on the scrollable, then the grid will call out to the server again as I scroll, and once again all items data is retrieved, but it seems to only make use of the returned items PageSize at a time -- each time I scroll more than that, it calls back to the server to once again get all items, etc.
I thought ServerOperation(false) would tell the grid that all data will be requested through a single request so it wouldn't have to call back to the server each time.
The only thing I've found to work is to set PageSize(100000) (with or without virtual scrolling and with or without ServerOperation doesn't seem to affect it) to ensure that the number of items displayed is all the data that was returned, which in this case is only about 3000. This works, but seems pretty hacky.
Is there a better way to accomplish what I want?
Hello,
I am trying to export telerik radgrid into excel 2007 i.e. .xlsx format. I am using VS 2013.Though its exported, but column formats are not coming correctly. Its working perfectly in .xls format.
Code for .xls is working correctly :
if (gvAttendanceDetails.Items.Count > 0)
{
isExport = true;
gvAttendanceDetails.ExportSettings.ExportOnlyData = true;
gvAttendanceDetails.ExportSettings.IgnorePaging = true;
gvAttendanceDetails.ExportSettings.OpenInNewWindow = true;
gvAttendanceDetails.ExportSettings.FileName = Guid.NewGuid().ToString();
gvAttendanceDetails.MasterTableView.Caption = lblSummary.Text + "<br/>" + lbllDepartment.Text + ":" + lblDepartemnt.Text + "<br/>" + lbllManager.Text + ":" + lblManager.Text + "<br/>" +
lbllNoOfWrk.Text + ":" + lblNoOfWrk.Text + "<br/>" + lbllDaysPrsnt.Text + ":" + lblDaysPrsnt.Text + "<br/>" +
lbllDaysAbsent.Text + ":" + lblDaysAbsent.Text + "<br/>" + lbllLeaveDuty.Text + ":" + lbllLeaveDuty.Text + "<br/>" +
lbllSelfService.Text + ":" + lblSelfService.Text + "<br/>" + lbllWeekend.Text + ":" + lblWeekend.Text + "<br/>";
gvAttendanceDetails.MasterTableView.ExportToExcel();
}
else
{
RadWindowManager1.RadAlert("There are no Details available", null, null, "Error", "");
}
-------------------------------------------------------
The only line highlighted below i have added to export into .xlsx
if(gvAttendanceDetails.Items.Count > 0)
{
isExport = true;
gvAttendanceDetails.ExportSettings.ExportOnlyData = true;
gvAttendanceDetails.ExportSettings.IgnorePaging = true;
gvAttendanceDetails.ExportSettings.OpenInNewWindow = true;
gvAttendanceDetails.ExportSettings.Excel.Format = Telerik.Web.UI.GridExcelExportFormat.Xlsx;
gvAttendanceDetails.ExportSettings.FileName = DateTime.Now.ToString().Replace(":", "");
gvAttendanceDetails.MasterTableView.Caption = lblSummary.Text + "<br/>" + lbllDepartment.Text + ":" + lblDepartemnt.Text + "<br/>" + lbllManager.Text + ":" + lblManager.Text + "<br/>" +
lbllNoOfWrk.Text + ":" + lblNoOfWrk.Text + "<br/>" + lbllDaysPrsnt.Text + ":" + lblDaysPrsnt.Text + "<br/>" +
lbllDaysAbsent.Text + ":" + lblDaysAbsent.Text + "<br/>" + lbllLeaveDuty.Text + ":" + lbllLeaveDuty.Text + "<br/>" +
lbllSelfService.Text + ":" + lblSelfService.Text + "<br/>" + lbllWeekend.Text + ":" + lblWeekend.Text + "<br/>";
gvAttendanceDetails.MasterTableView.ExportToExcel();
}else
{
}
In the attached file i have highlighted in yellow color. Head format is coming correctly, its coming in a single line. And in time column is coming incorrectly.
Can anyone help on this.
Thanks in advance.