I have an Ultrawebgrid (below) that is loaded dynamically and has several columns, but only one column is editable. It is a numeric value, that can be either a number, percent, or boolean (that must show as yes/no). There is no sorting or paging. My problem is two-fold. 1) I can't figure out how to edit the cells in the value column, also, how to dynamically format the value, number, percent, or boolean(yes/no) depending upon the value in another (hidden) column that notes the record type. Can anyone give me some ideas or an example please? Thanks.
<igtbl:UltraWebGrid ID="igGrid" runat="server" DisplayLayout-AutoGenerateColumns="true"EnableAppStyling="True" StyleSetName="Office2007Blue" StyleSetPath="~/ig_res/"DisplayLayout-CellPaddingDefault="5" ><Bands><igtbl:UltraGridBand><AddNewRow View="NotSet" Visible="NotSet"></AddNewRow></igtbl:UltraGridBand></Bands><DisplayLayout BorderCollapseDefault="Separate" CellPaddingDefault="5" Name="igStop"RowHeightDefault="20px" Version="4.00" ><FrameStyle></FrameStyle><ActivationObject BorderColor="" BorderWidth=""></ActivationObject></DisplayLayout></igtbl:UltraWebGrid>
Hello dbishop9 ,
Thank you for posting in our forum.
Regarding the editing of the cell. If you need only one particular cell to be editable you can set the Allow Update property under the Updating feature to “Do not allow” and specifically set the AllowUpdate property of the column you want to be editable to AllowUpdate.Yes.
Regarding the dynamic reformatting.There are two approaches you could take.
1)You could change the type of data you send to the column from the data source of the grid before you bind since you may change the Text property of the cell to whatever string you like but the Value would continue containing the data from the data source(for example the shown text in a cell may be “Yes” but when you enter edit mode you’ll have the actual value). This means that the data will be displayed correctly but once you enter edit mode you’ll see the numeric value from the data source.
2) Use an unbound column to show and edit the data and then manually update the data source.
In this case you can use an unbound column of type string in which you can show the data you want to the user(Yes/No for Boolean, number + % or normal number).
You could also delete this column on postback and re-create it if you want further control over what it displays. For example if you want it to contain differnt data type or some editor in certain cases or if you want to specify some Format for that column(with the Format property of the column).
I’m attaching a simple sample for your reference. Let me know if you have any further questions or concerns.
Best Regards,
Maya Kirova
Developer Support Engineer
Infragistics, Inc.
http://ko.infragistics.com/support
Thanks so much Maya. Now I have a table with several editable columns, so I have decided for this UltraWebGrid to use the Edit Template. I have my template all set up with dropdown, text, & date controls (below). I can click the row edit icon to bring it up just fine. I have two issues: 1) the individual cells are still editable when clicked on and I don't want this, just the row edit feature. I can't see where to turn that off, 2) when i click the OK button in the templage, how do I know which row was edited and do i use the FindControl for that row to get the data from the template controls? Thanks again for your help.
<igtbl:UltraWebGrid ID="igActions" runat="server" DisplayLayout-AutoGenerateColumns="true"EnableAppStyling="True" StyleSetName="Office2007Blue" StyleSetPath="~/ig_res/"DisplayLayout-CellPaddingDefault="5" DisplayLayout-AllowSortingDefault="Yes"><Bands><igtbl:UltraGridBand><AddNewRow View="NotSet" Visible="NotSet"></AddNewRow><RowEditTemplate> <asp:Table runat="server" Width="850px" ><asp:TableRow><asp:TableCell Width="125px"><asp:Label ID="lblProcess" runat="server" ForeColor="Navy" Font-Bold="true" Text="Process" ToolTip="Process"/><br /></asp:TableCell><asp:TableCell><asp:DropDownList ID="ddlProcess" runat="server" ToolTip="Process" DataSource='<% # aProcess %>'SelectedItem='<%# Bind("Process") %>'></asp:DropDownList></asp:TableCell></asp:TableRow><asp:TableRow><asp:TableCell><asp:Label ID="lblActionItem" runat="server" ForeColor="Navy" Font-Bold="true" Text="Action Item"ToolTip="Action Item" /><br /></asp:TableCell><asp:TableCell><button id="btnCheckActionItem" runat="server" style="font-size: 8pt; width: 80px; cursor: pointer;"tabindex="3" type="button">Check Spelling</button><br /><asp:TextBox ID="txtActionItem" runat="server" MaxLength="500" Rows="8" TextMode="MultiLine" ToolTip="500 character maximum" Width="98%"></asp:TextBox></asp:TableCell></asp:TableRow><asp:TableRow><asp:TableCell><asp:Label ID="lblActionType" runat="server" ForeColor="Navy" Font-Bold="true" Text="Action Type"ToolTip="Action Type" /><br /></asp:TableCell><asp:TableCell><asp:DropDownList ID="ddlActionItemType" runat="server" DataSource='<% # aItemType %>'SelectedItem='<%# Bind("ActionType") %>' ToolTip="Action Item Type"></asp:DropDownList></asp:TableCell></asp:TableRow><asp:TableRow><asp:TableCell><asp:Label ID="lblStatus" runat="server" ForeColor="Navy" Font-Bold="true" Text="Status"ToolTip="Status" /><br /></asp:TableCell><asp:TableCell><asp:DropDownList ID="ddlStatus" runat="server" DataSource='<% # aStatus %>' SelectedItem='<%# Bind("Status") %>'ToolTip="Status"></asp:DropDownList></asp:TableCell></asp:TableRow><asp:TableRow><asp:TableCell><asp:Label ID="lblAssignedTo" runat="server" ForeColor="Navy" Font-Bold="true" Text="Assigned To"ToolTip="Assigned To" /><br /></asp:TableCell><asp:TableCell><asp:TextBox ID="txtAssignedTo" runat="server" Width="150px"ToolTip="Assigned To"></asp:TextBox></asp:TableCell></asp:TableRow><asp:TableRow><asp:TableCell><asp:Label ID="lblDueDate" runat="server" ForeColor="Navy" Font-Bold="true" Text="Due Date"ToolTip="Due Date" /><br /></asp:TableCell><asp:TableCell><ig:WebDatePicker ID="igDueDate" runat="server" StyleSetName="Claymation" StyleSetPath="~/ig_res/"MinValue="1/1/1901" MaxValue="12/31/2050" NullText="" Nullable="true" DropDownCalendarID="WebMonthCalendar1" ></ig:WebDatePicker></asp:TableCell></asp:TableRow><asp:TableRow><asp:TableCell><asp:Label ID="lblCompletionDate" runat="server" ForeColor="Navy" Font-Bold="true"Text="Completed Date" ToolTip="Completed Date" /><br /></asp:TableCell><asp:TableCell><ig:WebDatePicker ID="igCompletionDate" runat="server" StyleSetName="Claymation" StyleSetPath="~/ig_res/"MinValue="1/1/1901" MaxValue="12/31/2050" NullText="" Nullable="true" DropDownCalendarID="WebMonthCalendar1"></ig:WebDatePicker></asp:TableCell></asp:TableRow><asp:TableRow><asp:TableCell ColumnSpan="2" HorizontalAlign="Center" ><input id="igtbl_reOkBtn" onclick="igtbl_gRowEditButtonClick(event);" style="width: 50px;"type="button" value="OK"> <input id="igtbl_reCancelBtn" onclick="igtbl_gRowEditButtonClick(event);" style="width: 50px;" type="button" value="Cancel"> </input></asp:TableCell></asp:TableRow></asp:Table></RowEditTemplate><RowTemplateStyle BackColor="Whitesmoke" BorderColor="White" BorderStyle="Ridge"><BorderDetails WidthBottom="3px" WidthLeft="3px" WidthRight="3px" WidthTop="3px" /></RowTemplateStyle></igtbl:UltraGridBand></Bands><DisplayLayout BorderCollapseDefault="Separate" CellPaddingDefault="5" Name="igActions"RowHeightDefault="20px" Version="4.00" AllowUpdateDefault="Yes"><FrameStyle></FrameStyle><ActivationObject BorderColor="" BorderWidth=""></ActivationObject></DisplayLayout></igtbl:UltraWebGrid>