I 'm using the webdatagrid v11.1 and need to do a validation. I have created a datatable and bind it to a webdatagrid wich generate all the columns needed.
But some cells are left blank, so I want to make a validation using this event: SelectionClientEvents-CellSelectionChanging to find if the new cell has content, if it has no content, cancel the selection, else the selection will continue.
This is the aspx code for webdatgrid
<ig:WebDataGrid ID="wdgCalendario" runat="server" Height="350px" Width="100%">
<Behaviors>
<ig:Activation Enabled="true" ActivationClientEvents-ActiveCellChanging="OnActiveCellChanging" />
<ig:Selection RowSelectType="None" CellClickAction="Cell" Enabled="true" CellSelectType="Single" SelectionClientEvents-CellSelectionChanging="OnCellChanging" SelectionClientEvents-CellSelectionChanged="OnCellChanged"></ig:Selection>
<ig:RowSelectors></ig:RowSelectors>
</Behaviors>
</ig:WebDataGrid>
And I hva no idea how this validation can be done via javascript.
Hi jcvegan,
Thank you for posting in our forum.
I would suggest that you handle the CellSelectionChanged client side event of the grid. You could use code, similar to the following to check if the selected cell is empty and deselect it, if it is:
function WebDataGrid1_Selection_CellSelectionChanged(sender, eventArgs) {
//gets the selected cell
var selectedCell = eventArgs.getSelectedCells().getItem(0);
//gets the value of the cell
var cellValue = selectedCell.get_value();
//if the value is null remove the selected cell from the selected cells collection
if (cellValue == null) {
sender.get_behaviors().get_selection().get_selectedCells().remove(selectedCell);
}
Please let me know if this helps.
Works like a charm! thanks!
And if I want to fix that generated column?
I'm not sure what you mean by fixing the column. Could you please clarify the question?
Thanks
I wanted to set the columnfixing behavior dynamically by javascript.... but you reply too late I have already done.
function OnInitialize(sender, e) {
var columnFixing = sender.get_behaviors().get_columnFixing();
if (columnFixing != null) {
columnFixing.fixColumnByKey("Mes", $IG.FixLocation.Left);
columnFixing.fixColumnByKey("DeudaSoles", $IG.FixLocation.Right);
columnFixing.fixColumnByKey("DeudaDolares", $IG.FixLocation.Right);
Hello jcvegan,
Thank you for sharing your code with the community.
If you have any other questions, please let me know.
Nikolay is there any way to diplay a tooltip when the mouse pointer is over a cell?
If this is possible, how might it be done?
You could set the Tooltip property for the grid cells in the InitializeRow event:
protected void WebDataGrid1_InitializeRow(object sender, Infragistics.Web.UI.GridControls.RowEventArgs e)
{
e.Row.Items[0].Tooltip = "Tooltip";
You could also create simple tooltip client-side in the Initialize client-side event handler. For example:
function initGrid(grid, args) {
var rows = grid.get_rows();
var rowCount = rows.get_length();
var cellCount = rowCount > 0 ? rows.get_row(0).get_cellCount() : 0;
for (var r = 0; r < rowCount; ++r) {
var row = rows.get_row(r);
for (var c = 0; c < cellCount; ++c) {
var cell = row.get_cell(c);
var cellEl = row.get_cell(c).get_element();
cellEl.title = cell.get_text();
Let me know if this helps.
Hi Nikolay,
I've started using the WebDateTimeEditor ti use it for filter some information... But what I want is somefilter like Star Date and End Date filter... this using javascript.. The validation dependes on a selected year from a webdropdown list, min date can not be higher than the max date and viceversa.
Is there any way to set this up on javascript... I post it on the forum of editors last week and no reply, so I ask it to you.
Thanks for the answers.
In order to use WebDropDown selected item to set a WebDateTimeEditor’s min or max values, I would suggest that you handle the SelectionChanged client-side event of the drop down, using something like the following code:
function selectionChanged(sender, args) {
var dateEditor1 = $find("WebDateTimeEditor1");
var minDate = new Date();
minDate = "01/01/" + sender.get_selectedItem().get_text();
dateEditor1.set_minValue(minDate);
Then, if you have two WebDateTimeEditors, you could check which date is after the other, using the function:
function validate() {
var dateEditor2 = $find("WebDateTimeEditor2");
var startDate = dateEditor1.get_value();
var endDate = dateEditor2.get_value();
if (endDate.getTime() < startDate.getTime()) {
alert("Please enter valid dates");
If you need any further assistance on the matter, please do not hesitate to ask.
Please let me know if you have any other questions.
Hi there:
I'am having some troubles when binding webdatargid to a datasource.
I'm getting this error :
on execution.
This is my aspx code for webdatagrid
<ig:WebDataGrid ID="wdgMovimientos" runat="server" Height="133px" Width="100%" AutoGenerateColumns="false" DataKeyFields="CodigoTemporal">
<Columns>
<ig:BoundDataField DataFieldName="CodigoTemporal" Key="CodigoTemporal" Hidden="true">
<Header Text="Código" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="Codigo" Key="Codigo" Width="50px" >
<ig:BoundDataField DataFieldName="FechaRegistro" Key="FechaRegistro" Width="50px" >
<Header Text="Fecha Registro" />
<ig:BoundDataField DataFieldName="TipoPago" Key="TipoPago" >
<Header Text="Tipo Pago" />
<ig:BoundDataField DataFieldName="NombreEntidad" Key="NombreEntidad" Width="50px" >
<Header Text="Entidad" />
</Columns>
And the visual basic code
Dim filtros As MovimientosBE = Me.ObtenerFiltros()
Dim resultado As List(Of MovimientosBE) = (New MovimientosSL).ObtenerPorCampos(filtros)
wdgMovimientos.DataSource = resultado
wdgMovimientos.DataBind()
I know that the problem is on webdatagrid because when I comment the control and all its references, the page works fine....
so how can I fix this problem....?