Hi evryone,
I am facing this problem from quite some time Please help me out.
I have a Page with a webgrid i have 5 columns 2 uneditable and 3 are populated with dropdowns on selection of an employee from the first dropdown i have to populate his name and his job description in the remaining two columns.
I am using this in the javascript to update the cell but i couldnt figure out how to do .
function cellUpdate(gridID, valueListID, cellID)
{
var col = igtbl_getColumnById(cellID);
if (col.Key != "Personal_Number") return;
var list = igtbl_getElementById(valueListID);
var row = igtbl_getRowById(cellID);
var name=list.selectedIndex.innerText;
if (row != null)
{alert("Hello");
row.getCell(49).setValue(name); row.getCell(51).setValue(name);
} }
so i Want to set cell 49 and 51 with the respective values but i dont know how to do it .
I also have another idea to open a popup window as a button is clicked in the grid and in the popup am going to show the grid where they can select a Row and on double click I thought i wud capture that data in a hidden variable and close the popup and reload the opener but as i reload the opener the hidden variable is gone and the value cannot be persisted .
Also if anybody know how to assign a value to a a ultrawebgrid column in the child window which is present in the parent window , please post their comments.
Please Help me out from this situation either one of the methods any help would be kindly appreciated.
Thanks in Advance.
Krishna.
Hello,
I think there an online example that is very close to what you need - three column grid, three combos in each column that are related -- selection of second depends on selection of first, selection of third depends on the second.
The example (with full C# / VB.NET source code) is located here.
Hope this helps.
Hey Rumen,
Thanks for your reply i have already seen that example but my resources dont want to use a webcombo they want to show it as a popup and populate the columns by closing the popup and refreshing the parent page in one scenario and populate the dropdowns without a webcombo in another scenario.
Could you please tell me how to set the value for the drropdowns based on the selectedindex value of the dropdown.
Thanks,
Hello Krishna,
In this case I'd say, the easiest way would be to use templated columns for each of the three dropdowns with AutoPostBack, e.g.
<CellTemplate>
<asp:dropdownlist runat="server" id="DropDownList1" AutoPostBack="True" OnSelectedIndexChanged="MyEvent" />
</CellTemplate>
and then, in the respective event handler bind the other dropdown based on that in the "MyEvent" event handler. If postback is not desirable, you can wrap the whole thing in asp:UpdatePanel.
Thanks Rumen,
But when we do the auto post back true all the other data is getting refreshed and my grid is not displaying the values correctly .
This is my grid
<igtbl1:ultrawebgrid id=myUltraWebGrid runat="server" Height="199px" Width="100%"> <DisplayLayout JavaScriptFileName="/wwna/ig_common/20052/scripts/ig_WebGrid.js" RowHeightDefault="20px" Version="4.00" JavaScriptFileNameCommon="/wwna/ig_common/20052/Scripts/ig_shared.js" BorderCollapseDefault="Separate" Name="myUltraWebGrid" CellClickActionDefault="RowSelect"> <AddNewBox> <Style BorderWidth="1px" BorderStyle="Solid" BackColor="LightGray"> </Style> </AddNewBox> <Pager> <Style BorderWidth="1px" BorderStyle="Solid" BackColor="LightGray"> </Style> </Pager> <HeaderStyleDefault BorderStyle="None" ForeColor="Black" BackColor="#89A8CB" Height="20px"> <BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="1px" ColorLeft="White"></BorderDetails> </HeaderStyleDefault> <FrameStyle Width="100%" BorderWidth="1px" Font-Size="8pt" Font-Names="Verdana" BorderStyle="Groove" Height="199px"></FrameStyle> <FooterStyleDefault BorderWidth="1px" BorderStyle="Solid" BackColor="LightGray"> <BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="1px" ColorLeft="White"></BorderDetails> </FooterStyleDefault> <ClientSideEvents DblClickHandler="dblClickGrid" ClickCellButtonHandler="cellbuttonclick" ValueListSelChangeHandler="cellUpdate"></ClientSideEvents> <EditCellStyleDefault BorderWidth="0px" BorderStyle="None"></EditCellStyleDefault> <RowAlternateStyleDefault BackColor="#CED9E4"></RowAlternateStyleDefault> <RowStyleDefault Cursor="Hand" BorderWidth="1px" BorderColor="Gray" BorderStyle="Solid" BackColor="White"> <Padding Left="3px"></Padding> <BorderDetails WidthLeft="0px" WidthTop="0px"></BorderDetails> </RowStyleDefault> <ImageUrls ImageDirectory="/wwna/ig_common/Images/"></ImageUrls> </DisplayLayout> <Bands> <igtbl1:UltraGridBand></igtbl1:UltraGridBand> </Bands> </igtbl1:ultrawebgrid>
and am defining all the columns and styles in the intialize layout as shown below .
private void myUltraWebGrid_InitializeLayout(object sender, Infragistics.WebUI.UltraWebGrid.LayoutEventArgs e) { try { myUltraWebGrid.DisplayLayout.RowAlternateStyleDefault.BackColor = Color.FromArgb(200, 230, 221);
myUltraWebGrid.DisplayLayout.RowAlternateStyleDefault.ForeColor = Color.DarkBlue; foreach (Infragistics.WebUI.UltraWebGrid.UltraGridColumn clm in myUltraWebGrid.Bands[0].Columns) { clm.Hidden = true; } this.myUltraWebGrid.DisplayLayout.CellPaddingDefault= 2; this.myUltraWebGrid.DisplayLayout.CellSpacingDefault= 0;
this.myUltraWebGrid.DisplayLayout.FrameStyle.BorderWidth=1; this.myUltraWebGrid.DisplayLayout.FrameStyle.BorderStyle= BorderStyle.Solid; this.myUltraWebGrid.DisplayLayout.GridLinesDefault=Infragistics.WebUI.UltraWebGrid.UltraGridLines.Vertical;
this.myUltraWebGrid.DisplayLayout.HeaderStyleDefault.BorderStyle= BorderStyle.Solid; this.myUltraWebGrid.DisplayLayout.HeaderStyleDefault.Font.Bold= true;
this.myUltraWebGrid.DisplayLayout.RowStyleDefault.BorderStyle=BorderStyle.Solid; this.myUltraWebGrid.DisplayLayout.RowStyleDefault.BorderWidth= new Unit(1,UnitType.Point); myUltraWebGrid.Bands[0].HeaderStyle.VerticalAlign = VerticalAlign.Top; myUltraWebGrid.DisplayLayout.RowStyleDefault.VerticalAlign = VerticalAlign.Top; myUltraWebGrid.DisplayLayout.AllowSortingDefault = Infragistics.WebUI.UltraWebGrid.AllowSorting.Yes; myUltraWebGrid.DisplayLayout.HeaderClickActionDefault = Infragistics.WebUI.UltraWebGrid.HeaderClickAction.SortSingle; this.myUltraWebGrid.DisplayLayout.SelectTypeRowDefault =Infragistics.WebUI.UltraWebGrid.SelectType.Extended; //******************************************************************************************** string Role=Utilities.ConvertNULLtoString(Session["Role"]); if(Role=="2") {
this.myUltraWebGrid.DisplayLayout.CellClickActionDefault= Infragistics.WebUI.UltraWebGrid.CellClickAction.Edit;
populateTrade(); populateEmployeeNumber();
myUltraWebGrid.DisplayLayout.Bands[0].Columns.FromKey("Personal_Number").ValueList = valueEmployeeNumberList; myUltraWebGrid.DisplayLayout.Bands[0].Columns.FromKey("selected").Type=Infragistics.WebUI.UltraWebGrid.ColumnType.Custom; myUltraWebGrid.DisplayLayout.Bands[0].Columns.FromKey("selected").CellButtonStyle.BackColor=Color.Maroon; myUltraWebGrid.DisplayLayout.Bands[0].Columns.FromKey("Personal_Number").Type = Infragistics.WebUI.UltraWebGrid.ColumnType.DropDownList; myUltraWebGrid.DisplayLayout.Bands[0].Columns.FromKey("Trade").ValueList = valueTradeList; myUltraWebGrid.DisplayLayout.Bands[0].Columns.FromKey("Trade").Type = Infragistics.WebUI.UltraWebGrid.ColumnType.DropDownList;
//******************************************************************************************** //myUltraWebGrid.Bands[0].Columns.FromKey("Work_Request_No").Hidden =true;
myUltraWebGrid.Bands[0].Columns.FromKey("selected").Hidden =false; myUltraWebGrid.Bands[0].Columns.FromKey("Personal_Number").Hidden = false; myUltraWebGrid.Bands[0].Columns.FromKey("Emp_Name").Hidden =false; myUltraWebGrid.Bands[0].Columns.FromKey("Trade").Hidden =false; myUltraWebGrid.Bands[0].Columns.FromKey("WO_Event_Id").Hidden =false; myUltraWebGrid.Bands[0].Columns.FromKey("WO_Event_Id").AllowUpdate=Infragistics.WebUI.UltraWebGrid.AllowUpdate.No; myUltraWebGrid.Bands[0].Columns.FromKey("selected").AllowUpdate=Infragistics.WebUI.UltraWebGrid.AllowUpdate.No; myUltraWebGrid.Bands[0].Columns.FromKey("Personal_Number").AllowUpdate=Infragistics.WebUI.UltraWebGrid.AllowUpdate.Yes; myUltraWebGrid.Bands[0].Columns.FromKey("Emp_Name").AllowUpdate=Infragistics.WebUI.UltraWebGrid.AllowUpdate.Yes; myUltraWebGrid.Bands[0].Columns.FromKey("Trade").AllowUpdate=Infragistics.WebUI.UltraWebGrid.AllowUpdate.Yes; // 'set captions for headings myUltraWebGrid.Bands[0].Columns.FromKey("WO_Event_Id").HeaderText ="Event #"; myUltraWebGrid.Bands[0].Columns.FromKey("selected").HeaderText = "Assign Employee"; myUltraWebGrid.Bands[0].Columns.FromKey("Personal_Number").HeaderText = "Personal #"; myUltraWebGrid.Bands[0].Columns.FromKey("Emp_Name").HeaderText = "Employee Name"; myUltraWebGrid.Bands[0].Columns.FromKey("Trade").HeaderText ="Trade"; //myUltraWebGrid.Bands[0].Columns.FromKey("Status_Description").HeaderText = "Status"; myUltraWebGrid.Bands[0].Columns.FromKey("WO_Event_Id").Width = Unit.Percentage(5); myUltraWebGrid.Bands[0].Columns.FromKey("selected").Width = Unit.Percentage(5); myUltraWebGrid.Bands[0].Columns.FromKey("Personal_Number").Width = Unit.Percentage(40); myUltraWebGrid.Bands[0].Columns.FromKey("Emp_Name").Width = Unit.Percentage(30); myUltraWebGrid.Bands[0].Columns.FromKey("Trade").Width = Unit.Percentage(20); myUltraWebGrid.Bands[0].Columns.FromKey("selected").Header.Style.Wrap=false; myUltraWebGrid.DisplayLayout.AddNewBox.Hidden =false; //this.myUltraWebGrid.DisplayLayout.CellClickActionDefault= Infragistics.WebUI.UltraWebGrid.CellClickAction.RowSelect; myUltraWebGrid.DisplayLayout.CellClickActionDefault = CellClickAction.Edit; myUltraWebGrid.DisplayLayout.AllowUpdateDefault = AllowUpdate.Yes; myUltraWebGrid.Bands[0].AddButtonCaption = "Add Resource"; myUltraWebGrid.DisplayLayout.AllowAddNewDefault = Infragistics.WebUI.UltraWebGrid.AllowAddNew.Yes; }
}
so here the WO_Event_Id is uneditable and when i select a personal number the employee name and the trade shld be automatically populated.
If you can look into this and help me out that wud be a great help.
Krishna