Hi,
I am unable to see the numericcolumn filter image for the following scenario. Is there a way to auto-set the column width to the header width.
Consider the following scenario:
I have a grid with the width specified. Varoius columns are added to that grid. Filtering is allowed, resizing is allowed.
When i run this code, the columns does not display the filter image. It gets hidden. Only when i manually resize the column, i am able to see the filter icon.
<asp:Panel ID="PanelForGrid" Width="900px" Height="400Px" runat="server">
<Grid ID="PortfolioGrid" runat="server" Width="100%" Height="100%" AutoGenerateColumns="false"
AllowFilteringByColumn="true" AllowSorting="true" AllowPaging="true" PageSize="3">
<ClientSettings EnablePostbackOnRowClick="true">
<Selecting AllowRowSelect="True" />
<Scrolling AllowScroll="true" UseStaticHeaders="true" EnableVirtualScrollPaging="true" ScrollHeight="400px" />
<Resizing AllowColumnResize="true" AllowRowResize="true" ClipCellContentOnResize="false" EnableRealTimeResize="true" AllowResizeToFit="true" ResizeGridOnColumnResize="false"/>
</ClientSettings>
<MasterTableView DataKeyNames="Id" TableLayout="Fixed">
<columns>
<GridBoundColumn DataField="Id" HeaderText="Id" UniqueName="Guid" Visible="true"></GridBoundColumn>
<GridBoundColumn DataField="FirstName" HeaderText="FirstName" UniqueName="FirstName" Visible="true"></GridBoundColumn>
<GridBoundColumn DataField="LastName" HeaderText="LastName" UniqueName="LastName" Visible="true"> </GridBoundColumn>
<GridDateTimeColumn DataField="DOB" HeaderText="DOB" UniqueName="DOB" Visible="true" DataFormatString="{0:dd/MM/yyyy}" EditDataFormatString="dd MMMM, yyyy hh:mm tt"> </GridDateTimeColumn >
<GridNumericColumn DataField="DeptId" DataType="System.UInt16" HeaderText="DeptId" UniqueName="DeptId" Visible="true"> </GridNumericColumn>
<GridNumericColumn DataField="Salary" HeaderText="Salary" UniqueName="Salary" Visible="true" > </GridNumericColumn>
<GridBoundColumn DataField="Designation" HeaderText="Designation" UniqueName="Designation" Visible="true"> </GridBoundColumn>
</columns>
</MasterTableView>
</Grid>
</asp:Panel>
Seems the filtering textbox has a fixed width set in the control.
Please suggest a way to override that behavior.
Thanks
Tarun
<
InsertItemTemplate
>
<
tr
class
=
"rlvIEdit"
>
<
td
colspan
=
"7"
>
<
table
cellspacing
=
"0"
class
=
"rlvEditTable"
>
<
tr
>
<
td
>
<
asp:Label
ID
=
"Officer_NameLabel2"
runat
=
"server"
AssociatedControlID
=
"rcbOfficer"
Text
=
"Officer_Name"
></
asp:Label
>
</
td
>
<
td
>
<
telerik:RadComboBox
ID
=
"rcbOfficer"
runat
=
"server"
DataSourceID
=
"dsOfficer"
DataKeyField
=
"Rosterid"
DataTextField
=
"officer_name"
DataValueField
=
"officer_name"
AllowCustomText
=
"True"
Text='<%# Bind("Officer_Name") %>'>
</
telerik:RadComboBox
>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
asp:Label
ID
=
"ScheduleLabel2"
runat
=
"server"
AssociatedControlID
=
"ScheduleTextBox"
Text
=
"Schedule"
></
asp:Label
>
</
td
>
<
td
>
<
asp:TextBox
ID
=
"ScheduleTextBox"
runat
=
"server"
CssClass
=
"rlvInput"
Text='<%# Bind("Schedule") %>' />
</
td
>
</
tr
>
<
tr
>
<
td
>
<
asp:Label
ID
=
"UnitLabel2"
runat
=
"server"
AssociatedControlID
=
"rcbIUnit"
Text
=
"Unit"
></
asp:Label
>
</
td
>
<
td
>
<
telerik:RadComboBox
ID
=
"rcbIUnit"
runat
=
"server"
DataSourceID
=
"dsUnit"
DataKeyField
=
"Unitid"
DataTextField
=
"unit"
DataValueField
=
"unit"
AllowCustomText
=
"True"
Text='<%# Bind("unit") %>'>
</
telerik:RadComboBox
>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
asp:Label
ID
=
"VehicleLabel2"
runat
=
"server"
AssociatedControlID
=
"rcbIVehicle"
Text
=
"Vehicle"
></
asp:Label
>
</
td
>
<
td
>
<
telerik:RadComboBox
ID
=
"rcbIVehicle"
runat
=
"server"
DataSourceID
=
"dsVehicle"
DataKeyField
=
"vehicleid"
DataTextField
=
"vehiclenumber"
DataValueField
=
"vehiclenumber"
AllowCustomText
=
"True"
Text='<%# Bind("vehicle") %>'>
</
telerik:RadComboBox
>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
asp:Label
ID
=
"HoursLabel2"
runat
=
"server"
AssociatedControlID
=
"HoursTextBox"
Text
=
"Hours"
></
asp:Label
>
</
td
>
<
td
>
<
asp:TextBox
ID
=
"HoursTextBox"
runat
=
"server"
CssClass
=
"rlvInput"
Text='<%# Bind("Hours") %>'/>
</
td
>
</
tr
>
<
tr
>
<
td
colspan
=
"2"
>
<
asp:Button
ID
=
"PerformInsertButton"
runat
=
"server"
CommandName
=
"PerformInsert"
CssClass
=
"rlvBAdd"
Text
=
" "
ToolTip
=
"Insert"
/>
<
asp:Button
ID
=
"CancelButton"
runat
=
"server"
CausesValidation
=
"False"
CommandName
=
"Cancel"
CssClass
=
"rlvBCancel"
Text
=
" "
ToolTip
=
"Cancel"
/>
</
td
>
</
tr
>
</
table
>
</
td
>
</
tr
>
</
InsertItemTemplate
>
<
telerik:RadGrid
ID
=
"GridDD"
runat
=
"server"
Width
=
"97%"
ShowStatusBar
=
"True"
AllowSorting
=
"True"
PageSize
=
"20"
GridLines
=
"None"
AllowPaging
=
"True"
AutoGenerateColumns
=
"false"
DataSourceID
=
"diemdanh_task"
Skin
=
"Hay"
EnableAJAX
=
"true"
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
AlwaysVisible
=
"true"
PageSizeLabelText
=
"Kích cỡ"
/>
<
MasterTableView
TableLayout
=
"Fixed"
DataKeyNames
=
"ID"
EditMode
=
"InPlace"
ClientDataKeyNames
=
"ID"
CommandItemDisplay
=
"Bottom"
>
<
CommandItemTemplate
>
<
div
style
=
"height: 30px; text-align: right;"
>
<
asp:Image
ID
=
"imgCancelChanges"
runat
=
"server"
ImageUrl
=
"~/DesktopModules/YourCompany.DD/Images/cancel.gif"
AlternateText
=
"Cancel changes"
ToolTip
=
"Cancel changes"
Height
=
"24px"
Style="cursor: pointer;
margin: 2px 5px 0px 0px;"
onclick
=
"CancelChanges();"
/>
<
asp:Image
ID
=
"imgProcessChanges"
runat
=
"server"
ImageUrl
=
"~/DesktopModules/YourCompany.DD/Images/ok.gif"
AlternateText
=
"Process changes"
ToolTip
=
"Process changes"
Height
=
"24px"
Style="cursor: pointer;
margin: 2px 5px 0px 0px;"
onclick
=
"ProcessChanges();"
/>
</
div
>
</
CommandItemTemplate
>
<
Columns
>
<
telerik:GridBoundColumn
UniqueName
=
"ID"
DataField
=
"ID"
HeaderText
=
"ID"
ReadOnly
=
"True"
HeaderStyle-Width
=
"5%"
Visible
=
"false"
/>
<
telerik:GridBoundColumn
UniqueName
=
"ngaythang"
DataField
=
"ngaythang"
HeaderText
=
"Ngày tháng"
ReadOnly
=
"True"
HeaderStyle-Width
=
"5%"
/>
<
telerik:GridBoundColumn
UniqueName
=
"mahv"
DataField
=
"mahv"
HeaderText
=
"Mã HV"
ReadOnly
=
"True"
HeaderStyle-Width
=
"5%"
/>
<
telerik:GridBoundColumn
UniqueName
=
"hoten"
DataField
=
"hoten"
HeaderText
=
"Họ Tên"
ReadOnly
=
"True"
HeaderStyle-Width
=
"5%"
/>
<
telerik:GridBoundColumn
UniqueName
=
"ngaysinh"
DataField
=
"ngaysinh"
HeaderText
=
"Ngày Sinh"
ReadOnly
=
"True"
HeaderStyle-Width
=
"5%"
/>
<
telerik:GridTemplateColumn
UniqueName
=
"nghiphep"
HeaderText
=
"Nghỉ phép"
HeaderStyle-Width
=
"15%"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblnghiphep"
runat
=
"server"
Text='<%# Eval("nghiphep") %>' />
<
asp:TextBox
ID
=
"txtnghiphep"
runat
=
"server"
Text='<%# Bind("nghiphep") %>' Width="95%"
MaxLength="1" Style="display: none" />
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
UniqueName
=
"lydo"
HeaderText
=
"Lý do"
SortExpression
=
"lydo"
HeaderStyle-Width
=
"10%"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lbllydo"
runat
=
"server"
Text='<%# Eval("lydo") %>' />
<
asp:TextBox
ID
=
"txtlydo"
runat
=
"server"
Text='<%# Bind("lydo") %>' Width="95%" Style="display: none" />
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
>
<
ClientEvents
OnRowCreated
=
"RowCreated"
OnRowClick
=
"RowClick"
OnCommand
=
"RadGrid1_Command"
OnRowDestroying
=
"RowDestroying"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
<
asp:ObjectDataSource
ID
=
"diemdanh_task"
runat
=
"server"
DataObjectTypeName
=
"YourCompany.Modules.DD.DDInfo"
SelectMethod
=
"DD_GetAll"
TypeName
=
"YourCompany.Modules.DD.DDController"
UpdateMethod
=
"DD_Update"
OnInit
=
"Page_Load"
>
<
SelectParameters
>
<
asp:Parameter
Name
=
"fromdate"
DefaultValue
=
"07/11/2011"
DbType
=
"String"
/>
</
SelectParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"nghiphep"
DbType
=
"String"
/>
<
asp:Parameter
Name
=
"lydo"
DbType
=
"String"
/>
<
asp:Parameter
Name
=
"ID"
DbType
=
"String"
/>
</
UpdateParameters
>
</
asp:ObjectDataSource
>
Public Class DDController
<
DataObjectMethod
(DataObjectMethodType.Select)> Public Shared Function DD_GetAll(ByVal fromdate As String) As List(Of DDInfo)
Return CBO.FillCollection(Of DDInfo)(DataProvider.Instance.GetAllDD(fromdate))
End Function
<
DataObjectMethod
(DataObjectMethodType.Update)> Public Shared Sub DD_Update(ByVal objest As DDInfo)
DataProvider.Instance.UpdateDD(objest.nghiphep, objest.Lydo, objest.ID)
End Sub
End Class
Namespace
YourCompany.Modules.DD
Public
Class
DDInfo
Private
_mahv
As
String
Private
_ngaythang
As
String
Private
_nghiphep
As
String
Private
_lydo
As
String
Private
_ID
As
String
Private
_ngaysinh
As
String
Private
_hoten
As
String
Public
Property
ID()
As
String
Get
Return
_ID
End
Get
Set
(
ByVal
value
As
String
)
_ID = value
End
Set
End
Property
Public
Property
ngaythang()
As
String
Get
Return
_ngaythang
End
Get
Set
(
ByVal
value
As
String
)
_ngaythang = value
End
Set
End
Property
Public
Property
mahv()
As
String
Get
Return
_mahv
End
Get
Set
(
ByVal
value
As
String
)
_mahv = value
End
Set
End
Property
Public
Property
hoten()
As
String
Get
Return
_hoten
End
Get
Set
(
ByVal
value
As
String
)
_hoten = value
End
Set
End
Property
Public
Property
ngaysinh()
As
String
Get
Return
_ngaysinh
End
Get
Set
(
ByVal
value
As
String
)
_ngaysinh = value
End
Set
End
Property
Public
Property
nghiphep()
As
String
Get
Return
_nghiphep
End
Get
Set
(
ByVal
value
As
String
)
_nghiphep = value
End
Set
End
Property
Public
Property
Lydo()
As
String
Get
Return
_lydo
End
Get
Set
(
ByVal
value
As
String
)
_lydo = value
End
Set
End
Property
End
Class
Protected
Sub
RadAjaxManager1_AjaxRequest(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.AjaxRequestEventArgs)
Handles
RadAjaxManager1.AjaxRequest
If
e.Argument =
String
.Empty
Then
GridDD.Rebind()
End
If
Dim
editedItemIds
As
String
() = e.Argument.Split(
":"
)
Dim
i
As
Integer
For
i = 0
To
editedItemIds.Length - 2
Dim
ID
As
String
= editedItemIds(i)
Dim
updatedItem
As
GridDataItem =
CType
(GridDD.MasterTableView.FindItemByKeyValue(
"ID"
, ID), GridDataItem)
UpdateValues(updatedItem)
GridDD.DataBind()
Next
End
Sub
Protected
Sub
UpdateValues(
ByVal
updatedItem
As
GridDataItem)
Dim
txtBox
As
TextBox =
CType
(updatedItem.FindControl(
"txtnghiphep"
), TextBox)
diemdanh_task.UpdateParameters(
"nghiphep"
).DefaultValue = txtBox.Text
txtBox =
CType
(updatedItem.FindControl(
"txtlydo"
), TextBox)
diemdanh_task.UpdateParameters(
"lydo"
).DefaultValue = txtBox.Text
diemdanh_task.UpdateParameters(
"ID"
).DefaultValue = updatedItem.GetDataKeyValue(
"ID"
).ToString()
Try
diemdanh_task.Update()
Catch
ex
As
Exception
SetMessage(Server.HtmlEncode(
"Không thể cập nhật ngày phép. Lỗi: "
+ ex.StackTrace).Replace(
"'"
,
"'"
).Replace(vbCrLf,
"<br />"
))
End
Try
SetMessage(
"Đã cập nhật ngày phép học viên : "
& updatedItem.Item(
"mahv"
).Text)
End
Sub