Hello,
I have a Ultrawebgrid with a DropDownList in one of the columns. The dropdown takes the whole width available. I would like to make the dropdown itself smaller leaving the column with intact.
Thank you very much in advance
<
igtbl:ultrawebgrid id="m_gridIdentifiers" runat="server" style="z-index: 101; LEFT: 8px; position: absolute; top:
29px"
Width="400px" Height="120px" ImageDirectory="/ig_common/Images/" OnInitializeRow="m_gridIdentifiers_InitializeRow" TabIndex="17"
>
<DisplayLayout ColWidthDefault="120px" StationaryMargins="Header" RowHeightDefault
="26px"
Version="4.00" HeaderClickActionDefault="SortSingle" BorderCollapseDefault="Separate" Name
="ctl00xmxgridIdentifiers"
TableLayout="Fixed" AllowAddNewDefault="Yes" CellClickActionDefault="RowSelect" NoDataMessage
="No Assignments">
<FrameStyle CssClass="FrameStyle" Width="472px" Height="95px" > </FrameStyle
<HeaderStyleDefault CssClass="HeaderStyle" Height="20px" ></HeaderStyleDefault
<RowSelectorStyleDefault CssClass = "DefaultRowSelectorStyle" ></RowSelectorStyleDefault
<SelectedRowStyleDefault CssClass="SelectedRowStyle" ></SelectedRowStyleDefault
<RowStyleDefault CssClass = "DefaultRowStyle" ></RowStyleDefault
<RowAlternateStyleDefault CssClass="AlternateRowStyle" ></RowAlternateStyleDefault
<FooterStyleDefault CssClass="FooterStyle" ></FooterStyleDefault
<ClientSideEvents ClickCellButtonHandler="m_gridIdentifiers_ClickCellButtonHandler" InitializeLayoutHandler="m_gridIdentifiers_InitializeLayout"
</ClientSideEvents
</DisplayLayout
<Bands
<igtbl:UltraGridBand
<Columns
<igtbl:UltraGridColumn HeaderText="Identifier" Key="Identifier" IsBound="True" Width="145px" BaseColumnName="identifier" AllowResize="Free
">
<Header Caption="Identifier"
</Header
</igtbl:UltraGridColumn
<igtbl:UltraGridColumn Type="DropDownList" HeaderText="Production Status" Key="LiveStatusTypeName" IsBound="True" Width="145px" BaseColumnName="LiveStatusTypeName" AllowUpdate="Yes" AllowResize="Free
<Header Caption="Production Status"
<RowLayoutColumnInfo OriginX="1"
/>
<Footer
</Footer
<igtbl:UltraGridColumn Type="Button" CellButtonDisplay="Always" AllowUpdate = "Yes" Width="110px" AllowResize="Fixed" HeaderText=""
<Header Caption
="">
<RowLayoutColumnInfo OriginX="2" ></RowLayoutColumnInfo
<RowLayoutColumnInfo OriginX="2"
<igtbl:UltraGridColumn HeaderText="RegSourceIdentifierID" Width="1px" Key="RegSourceIdentifierID" Hidden="True" IsBound="True" BaseColumnName
="RegSourceIdentifierID">
<Header Caption="RegSourceIdentifierID"
<RowLayoutColumnInfo OriginX="3"></RowLayoutColumnInfo
<RowLayoutColumnInfo OriginX="3"
</Columns
</igtbl:UltraGridBand
</Bands
</igtbl:ultrawebgrid
I have the same issue but have not yet found a solution. I loaded the NetAdvantage 10.2 Service Pack that allows me to use web grids successfully under IE 9. That's when I noticed this begin to occur. When I drop the list down using IE 8, the entire width of the field does not display: only the width of the grid column.
One more thing to note. I added the following line of code:
e.Layout.Bands(0).Columns(2).VaueList.Style.Width = "200px"
with no effect when using eitehr IE8 or IE9.
Thank you for sharing your solution with the community.
If you have any other questions please feel free to contact me.
Thanks Nikolay. I have actually come up with the perfect solution for my application. Instead of using a style sheet or DisplayMember / ValueMember properties, I manually built the valuelist from my dataview using valuelistitems.add("ValueString","DisplayString") and it works perfectly. Sample code follows:
Private Sub RefreshPersonnelDropDown()
' Define the variables.
Dim intCounter As Integer
Dim dvwValueList As DataView
Dim vList As New Infragistics.WebUI.UltraWebGrid.ValueList()
Me.WebGridName.Columns(2).ValueList = vList
Dim EmpNmList As Infragistics.WebUI.UltraWebGrid.ValueList = Me.WebGridName.Columns(2).ValueList
Try
‘ dvwValueList is a dataview already created.
Me.WebGridName.Columns(2).ValueList.ValueMember = "dvwValueList"
' Make the name column a drop down list containing employee names.
' The left truncated value of the field appears in the valuelist display; the full string is the value that gets used.
Me.WebGridName.Columns(2).Type = Infragistics.WebUI.UltraWebGrid.ColumnType.DropDownList
intCounter = 0
For Each rowView As DataRowView In dvwValueList
Dim row As DataRow = rowView.Row
EmpNmList.ValueListItems.Add(dvwValueList.Table.Rows(intCounter).Item("FullName").ToString(), Left(dvwValueList.Table.Rows(intCounter).Item("FullName").ToString(), 50))
intCounter = intCounter + 1
Next
Me.WebGridName.DisplayLayout.Bands(0).Columns(2).ValueList = EmpNmList
Me.WebGridName.DisplayLayout.Bands(0).Columns(2).ValueList.DisplayStyle = Infragistics.WebUI.UltraWebGrid.ValueListDisplayStyle.DisplayText
Catch Ex As Exception
System.Diagnostics.Debug.WriteLine("Error:" & Ex.Message)
End Try
End Sub
Hi megryan,
I have tested the approach I suggested and it was working under IE9 too. I am using v11.1.20111.2178. I would suggest you to upgrade your product to a newer version.
I've also tried the following approach. This procedure is called to intialize the drop-down list. My hope was that I could display the first 40 characters of the FullName field in the drop-down list instead of the full width of the FullName field and then place the entire FullName string in the cell once the choice was made from the 40 character wide drop down list. Unfortunately, this logic does not seem to do anything. In IE9, the full field width displays in the drop-down valuelist instead of the 1st 40 characters. I may not understand the correct use of DisplayMember and ValueMember.
Private Sub RefreshDropDown()
Me.dgrLaborDetail.Columns(2).Type = Infragistics.WebUI.UltraWebGrid.ColumnType.DropDownList
Dim Category As Infragistics.WebUI.UltraWebGrid.ValueList = Me.dgrLaborDetail.Columns(2).ValueList
‘ Session("dvwEmplDesc") is a previously defined data view.
dvwValueList = Session("dvwEmplDesc")
Category.DataMember = "dvwValueList"
Category.DisplayMember = Left(dvwValueList.Table.Columns("FullName").ToString, 40)
Category.ValueMember = dvwValueList.Table.Columns("FullName").ToString
Category.DisplayStyle = Infragistics.WebUI.UltraWebGrid.ValueListDisplayStyle.NotSet
Category.DataSource = dvwValueList
Category.DataBind()
Thank you for the suggestion. I added this code to the page and got the results I was l;ooking for when I open the project using IE8; however, when I open the same project under IE9, the width of the drop-down list expands to the full size of the field when I click the drop-down list down-arrow. It's this behavior under IE9 that I was trying to correct in the first place. The IE8 drop-down looks acceptable without taking any action. Note that I am using UltraWebGrid 10.2 and have loaded the Infragistics 10.2 service pack to fix IE9 issues.