I have an UltraWebGrid (below) that is dynamically bound by Dataset server-side. I need it to have a row edit template with textbox, dropdownlist, and datepicker. I have several problems: 1) I cannot initialize the controls, like prefilling the dropdownlist, 2) I cannot set the initial values to the controls or get the changed values from them, 3) I have to do everything server-side in the code-behind, I cannot manipulate the data client-side, so no javascript. I've tried the various grid methods like updaterow, updategrid, etc., but cannot capture the right event(s). I am using vb.net 2008 with ig controls v10.3.20103.2134. I also cannot use the newer WebDataGrid, this has to be UltraWebGrid for now. I need to have something working correctly soon, so any help or simple example would be hugely appreciated. Thanks so much.
<igtbl:UltraWebGrid ID="igGrid" runat="server" DisplayLayout-AutoGenerateColumns="true"EnableAppStyling="True" StyleSetName="Office2007Blue" StyleSetPath="~/ig_res/"DisplayLayout-CellPaddingDefault="5" DisplayLayout-AllowSortingDefault="No"><Bands><igtbl:UltraGridBand><AddNewRow View="NotSet" Visible="NotSet"></AddNewRow></igtbl:UltraGridBand></Bands><DisplayLayout BorderCollapseDefault="Separate" CellPaddingDefault="5" Name="igStop" RowHeightDefault="20px" Version="4.00" CellClickActionDefault="Edit" AllowUpdateDefault="Yes"><FrameStyle></FrameStyle><ActivationObject BorderColor="" BorderWidth=""></ActivationObject></DisplayLayout></igtbl:UltraWebGrid>
Hello dbishop9 ,
We set it to the date control's input value.
var hdn=document.getElementById("HiddenPerformancePlanCompletedDate");
--> gets the hidden field on the page
var ChooserId=hdn.value;
--> gets the value that we stored in it
var row=igtbl_getRowById(rowId);
--> Gets the current row we’re on
var currentVal=row.getCell(1).getValue();
--> Gets the value of the cell containing the date time value.
var dateChooser=document.getElementById(ChooserId);
--> Gets the date chooser element from the editing template based on the id we stored in the hidden field.
dateChooser.value=currentVal;
dateChooser.Object.inputBox.value=currentVal;
--> sets the value for the date chooser’s input box.
In the meantime I got a better idea on how to get the instance of the date chooser. You can handle it’s initialize client event and from there get the instance of the control:
var dateChooser=null;
function WebDateChooser1_InitializeDateChooser(oDateChooser){
dateChooser=oDateChooser;
}
Then you can put in a global variable and use it in the AfterRowTemplateOpenHandler.
It would be better to use this approach instead of the one i previously suggested.
Best Regards,
Maya Kirova
Developer Support Engineer
Infragistics, Inc.
http://ko.infragistics.com/support
I understand that in the datecontrol init method we are setting the hidden control value to that of the datechooser. Then in the javascript below we are initializing the hidden control, getting its id, then getting the date from the current row, creating the datechooser var as the hidden date and setting the current row datevalue to the datechooser, which is based on the hidden control.
var hdn=document.getElementById("HiddenPerformancePlanCompletedDate");var ChooserId=hdn.value;var row=igtbl_getRowById(rowId);var currentVal=row.getCell(1).getValue(); var dateChooser=document.getElementById(ChooserId);dateChooser.value=currentVal;dateChooser.Object.inputBox.value=currentVal;
There are 2 things I don't understand. 1) We are taking the value of the rowedittemplate date control, which we have already established isn't reliable, and assigning it to the hidden control and 2) there is nowhere the javascript is assigning that value back to the datecontrol in the edit template? We are simply getting the date from the grid and putting it into the hidden control, which we already did in the date control's init method. I'm confused.....
Sorry, Maya. I thought I had this but I don't. I have copied/used exactly what you have sent, but it doesn't set the dates according to what is in the grid. It sets both my controls to the dates of the first row of the grid, even though I am editing the 6th row. The first row has two dates of 9/30/2011 each. The 6th row that I am editing has two dates of 9/30/2011 and 5/28/2011, but both the WebDateChoosers are still being set to 9/30/2011.
I'm just following up to see if you need any further assistance with this issue.
If so please let me know.
Try setting AllowNull to false. Then it will show only dates.