UltraWebGrid v 6.2 and .Net 2.0
I have a dropdownlist that is created and filled in the codebehind. I also have the first line/index blank, which is also inserted in the codebehind.Currently, upon enter, it goes to index 0. This happened before and after I inserted the blank at the index 0. Prior to inserting the blank, index 0 is what I wanted, but now that it is blank, I want it to go to index 1, which actually contains a value. How can I have the second row (index 1) be the selected value by default when the user enters the cell (if blank) of the dropdownlist?
Is there a property to set or do I have to use javascript?
Thanks!
This can be deleted. I figured out how to do it.
Hey Danid.. I am also facing the same issue.. can you please tell me how you get the things working now ?? Please help me out.. for this ..
Thanks in advance,
Sonu.
It really depends on how you are using the DropDownList in the grid. Is it in a templated column, is it in edit mode, is it in Edit Template?
One possible solution may be to locate the dropdownlist using FindControl in the InitializeRow event and programmatically set its SelectedIndex to 1.
You can also use SelectedValue declaratively, however you need to know that hardcoded Value of the first item and this solution might not work if the data changes.
Dropdowns are tricky, and I don't see what the problem is. In the past, I've solved dropdown problems by checking:
My dropdown doesn't have any HTML code in the .aspx file. I used the functions for the infragistics grid/dropdown to get the selection to go to the value 'Yes'. The value will always be 'Yes'. The problem that I'm having now is that when I enter the cell and there's already a value there, it automatically goes to the index 0, which is a blank (the user wanted) that I added in the code-behind.
it doesn't change the previous value, but my 'Yes' doesn't get populated either.To get the 'Yes' to populate automatically upon entering the dropdownlist:
With .ClientSideEvents.AfterEnterEditModeHandler = "enterCheckList"End With
var oGrid = igtbl_getGridById(gridName);
var oVL = new Array();
setDirtyFrame();
oVL = oCell.Column.ValueList;
oCell.setValue(oCell.Column.ValueList[i][1]);
}
Thanks for quicky response .. i think you misundertood my question. My question is something like...I have last two column in the Grid which is having the Column Type as DropDown List.
Column 1: For Country Description
ValueMember: Numeric..
DisplayMember: Text.
eg .. <option value="1">Afghanistan </option>
Column 2: For State
ValueMember: Text
eg. <option value="Alabama">Alabama</option>
But the isuse is When i double click on First Column that is " Country Description " it returns Index 0 that is BLANK. instead of orginal appearing value.
But this is not happening for Column 2 , its showing the correct value which was there on grid even after double clicking.
I have blank value on index 0 for both the Columns 1 and Column 2.
Here is the Display Lay Out.
<igtblA:UltraWebGrid ID="UltraWebGrid1" runat="server" Width="100%" Height="700px" >
<Bands>
<igtblA:UltraGridBand RowSelectors="Yes">
<igtblA:UltraGridColumn BaseColumnName="TaxId" Key="TaxId">
<Header Title="TaxId" Caption="TaxId">
<RowLayoutColumnInfo OriginX="1" />
</Header>
<Footer>
</Footer>
</igtblA:UltraGridColumn>
<igtblA:UltraGridColumn BaseColumnName="Description" Key="CountryofIncorporationID">
<Header Title="CountryofIncorporationID" Caption="CountryofIncorporationID">
<RowLayoutColumnInfo OriginX="2" />
<igtblA:UltraGridColumn BaseColumnName="StateofIncorporation" Key="StateofIncorporation">
<Header Title="StateofIncorporation" Caption="StateofIncorporation">
<RowLayoutColumnInfo OriginX="3" />
<igtblA:TemplatedColumn Hidden="true">
<Header >
<RowLayoutColumnInfo OriginX="4" />
</igtblA:TemplatedColumn>
</Columns>
</Bands>
<DisplayLayout AutoGenerateColumns="False" AllowColSizingDefault="Free" AllowColumnMovingDefault="OnServer"
RowSelectorsDefault="No" AllowSortingDefault="Yes" AllowUpdateDefault="Yes" BorderCollapseDefault="Separate"
FixedHeaderIndicatorDefault="Button" HeaderClickActionDefault="SortMulti" Name="UltraWebGrid1"
RowHeightDefault="20px" SelectTypeRowDefault="Extended" StationaryMargins="Header"
StationaryMarginsOutlookGroupBy="True" TableLayout="Fixed" HeaderTitleModeDefault="Always"
UseFixedHeaders="True" Version="4.00" SelectTypeCellDefault="Extended" AllowAddNewDefault="Yes"
AddNewRowDefault-View="Top" AddNewRowDefault-Visible="Yes">
<GroupByBox>
<BoxStyle BackColor="ActiveBorder" BorderColor="Window">
</BoxStyle>
</GroupByBox>
<EditCellStyleDefault CssClass="gridEdiCell"></EditCellStyleDefault>
<ClientSideEvents />
<GroupByRowStyleDefault BackColor="Control" BorderColor="Window" >
</GroupByRowStyleDefault>
<ActivationObject BorderColor="" BorderWidth="">
</ActivationObject>
<SelectedRowStyleDefault BackColor="#E0F1F9" BorderStyle="Solid" BorderWidth="1px">
<Padding Left="2px" Right="1px" />
</SelectedRowStyleDefault>
<FooterStyleDefault BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px">
<BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" />
<RowStyleDefault CssClass="gridRow" BorderColor="Silver" BorderStyle="Solid"
BorderWidth="1px" Font-Names="Microsoft Sans Serif" Font-Size="8.25pt">
<BorderDetails ColorLeft="Window" ColorTop="Window" ColorRight="#cccccc" ColorBottom="#cccccc" />
<HeaderStyleDefault CssClass="gridHeader" Font-Bold="True" HorizontalAlign="Center"
TextOverflow="Ellipsis" Cursor="Hand">
<EditCellStyleDefault BorderStyle="None" BorderWidth="0px">
<FrameStyle BackColor="Window" BorderColor="InactiveCaption" BorderStyle="Solid"
BorderWidth="1px" Font-Names="Microsoft Sans Serif" Font-Size="8.25pt" Wrap="True"
Width="100%" Height="700px">
</FrameStyle>
</DisplayLayout>
</igtblA:UltraWebGrid>
Here is the code Behind
countryList.DataSource = ds1.Tables[0];
countryList.ValueMember = ds1.Tables[0].Columns[0].ToString();
countryList.DisplayMember = ds1.Tables[0].Columns[1].ToString();
countryList.DataBind();
StateList.DataSource = ds2.Tables[0];
StateList.ValueMember = ds2.Tables[0].Columns[0].ToString();
StateList.DisplayMember = ds2.Tables[0].Columns[0].ToString();
StateList.DataBind();
conn.Close();
Please help me what i needed to do to have the same value which is currently binded with grid even if on double clicking on column as selected.
Sonu..