Can anybody give me a clue as to how to display password characters in place of the text in a WebDataGrid?
I've figured out how to do this when I am adding or editing a cell using a Grid Editor Provider, but it's not clear to me how to change the display to replace the text with password characters when I am just viewing the data table.
Appreciate any help!
Hello ptiedman and rsutton333,
I recommend you using Templated column containing WebTextEditor in the ItemTemplate.
By setting the border styles and colors you can make it looks like non templated field :
<ig:TemplateDataField Key="CategoryName" Width="250px">
<ItemTemplate>
<ig:WebTextEditor ID="WebTextEditor1" runat="server"
Value='<%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem, "CategoryName") %>'
TextMode="Password" ReadOnly="false" BorderStyle="None"
BorderColor="Transparent" BackColor="Transparent">
</ig:WebTextEditor>
</ItemTemplate>
<Header Text="CategoryName" />
</ig:TemplateDataField>
Hope this helps
Tsvetelina,
Thank you for the suggestion. It does address my issues with the password masking behavior in the UI, however I have not been able to determine how to get at the value in a template editor for each row of my grid during the post back when trying to save my data.
We have used the UltraWeb tools for several years, and are still stumbling along our way trying to learn the new Aikido controls.
I wrote some helper methods to get my index from my column name in my grids and then try to retrieve the value of the row (GridRecord) Items collection. This works fine for simple BoundDataField columns, but not the TemplateDataFields.
Public Shared Function GetColumnIndexFromKey(ByVal wdg As WebDataGrid, key As String) As Int32
Dim inx As Int32 = -1
inx = wdg.Columns.FromKey(key).Index
Return inx
End Function
val =
Convert.ToString(row.Items.GetValue(GetColumnIndexFromKey(wdg, key)))
Thank you for the suggestion. I am able to apply that pattern to may data save scenario.
Hello rsutton333 ,
In order to get the value from the template cell you should use FindControl method.
Below there is example of using CheckBox in ItemTemplate. Use the same logic regarding the WebTextEditor
<ig:TemplateDataField Key="CheckBoxColumn" Width="400px">
<asp:CheckBox ID="CheckBox1" runat="server" />
<Header Text="CheckBoxColumn" />
In order to get the CheckBox from the ItemTemplate you should use FindControl method.
Protected Sub WebDataGrid1_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.Web.UI.GridControls.RowEventArgs) Handles WebDataGrid1.InitializeRow
Dim chkBoxColIndex As Int32 = WebDataGrid1.Columns.FromKey("CheckBoxColumn").Index
Dim firstNameColIndex As Int32 = WebDataGrid1.Columns.FromKey("FirstName").Index
Dim checkBoxCell As GridRecordItem = e.Row.Items(chkBoxColIndex)
Dim chkBox As CheckBox = checkBoxCell.FindControl("CheckBox1")
If (e.Row.Items(firstNameColIndex).Text.Equals("Dave")) Then
chkBox.Checked = True
End If
End Sub
Let me know if you need further assistance regarding this.