Current filter:
                                You should refresh the page.
                                  • I have checked out several other questions (Q90953, Q105608, Q96187) and looked at the readonly documentation (ReadOnly Property), without finding any code that is close enough for me to use.

                                    I have an editform with a few controls on it, that works perfectly for editing. However, if the user does not have editing rights, I'd like to be able to set all the controls in the popup edit form to readonly when the value of Session("ChgYN") is False. I assume I need to do this in ASPxGridView1_HtmlRowCreated, but I can't figure out the syntax.

                                    I have also tried
                                    <dxe:ASPxTextBox ID="ASPxTextBoxCategory__CategoryName" runat="server" Text='<%# Bind("Category__CategoryName") %>' readonly="<%=Session("ChgYN") %>"></dxe:ASPxTextBox>
                                    but this approach isn't permitted.

                                    Here is part of the edit form (I have attached the complete form).

                                                 <EditForm>
                                                    <div style="padding:2px 8px 2px 8px">
                                                     <table width="750" border="0" align="center">
                                    <tr><th colspan="3" align="center">Category</th></tr>

                                    <%-- ' CategoryId --%><tr><td width="200px" align="right" valign="top"><dxe:ASPxLabel ID="ASPxLabelCategoryId" runat="server" Text="Category ID " ForeColor="navy"></dxe:ASPxLabel></td>
                                    <td colspan="2" width="500px" align="left" valign="top"><dxe:ASPxTextBox ID="ASPxTextBoxCategory__CategoryId" runat="server" Text='<%# Bind("Category__CategoryId") %>' Width="80px" ToolTip=""></dxe:ASPxTextBox>
                                    </td></tr>

                                    <%-- ' CategoryName --%><tr><td width="200px" align="right" valign="top"><dxe:ASPxLabel ID="ASPxLabelCategoryName" runat="server" Text="Category Name " ForeColor="navy"></dxe:ASPxLabel></td>
                                    <td colspan="2" width="500px" align="left" valign="top"><dxe:ASPxTextBox ID="ASPxTextBoxCategory__CategoryName" runat="server" Text='<%# Bind("Category__CategoryName") %>' Width="150px" ToolTip="Name of food category." Height="20px" MaxLength="15"></dxe:ASPxTextBox></td></tr>

                                    <%-- ' Description --%><tr><td width="200px" align="right" valign="top"><dxe:ASPxLabel ID="ASPxLabelDescription" runat="server" Text="Description " ForeColor="navy"></dxe:ASPxLabel></td>
                                    <td colspan="2" width="500px" align="left" valign="top"><dxe:ASPxMemo ID="ASPxMemoCategory__Description" runat="server" Text='<%# Bind("Category__Description") %>' Width="500px" Height="60px" ToolTip="Description"></dxe:ASPxMemo></td></tr>
                                                     </table>
                                                     </div>
                                                 <div style="text-align:right; padding:4px 8px 4px 4px">
                                                 <% If Session("ChgYN") Then %>
                                                       <input id="UpdateButton" type="button" value="Update" onclick="grid.UpdateEdit()" style="width:100px" />
                                                 <% End If %>
                                                 <input id="CancelButton" type="button" value="Cancel" onclick="grid.CancelEdit()" style="width:100px" />
                                                 </div>
                                                 </EditForm>

                                    I would like to set ASPxTextBox, ASPxMemo, ASPxComboBox and ASPxDateEdit controls to readonly if possible.

                                    Thanks in advance for your help. You guys have been invaluable in the past! \o/ \o/

                                Hello Donn,

                                > Thanks in advance for your help. You guys have been invaluable in the past! \o/ \o/
                                Thank you for your kind words, we appreciate them :)

                                > I'd like to be able to set all the controls in the popup edit form to readonly when the value of Session("ChgYN") is False.
                                This question can be easily solved in the following manner. You have to enable/disable (or change the ReadOnly) property in the control's Init event handler. I think that it is the easiest approach. The code should look like the following:

                                [VB.NET]
                                Protected Sub txt_Init(ByVal sender As Object, ByVal e As EventArgs) Dim txt As ASPxTextBox = TryCast(sender, ASPxTextBox) if (Convert.ToBoolean(Session("ChgYN")) = False) txt.ReadOnly = false; End Sub

                                This is the best way. For example, you can share the same Init event handler over all ASPxTextBoxes.
                                Please let me know if this approach helped you.

                                Thanks,
                                Vest

                                Perfect, thanks!