This is a migrated thread and some comments may be shown as answers.

Pop Up Edit Form Password Box

4 Answers 223 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kerim
Top achievements
Rank 1
kerim asked on 21 Jul 2010, 04:52 PM
Hi everyone..

i have textbox in radgrid pop up edit form which is textboxmode = password ...
i want to encode text  in there when press insert button .. i have password encoder dll
like that
passencode_.EncodePassword(tb_passWord.Text)

but i use automatic insert/update/delete operations...
how i add this encode method when insert button clicked in popup edit form ??

my code like this
                        <telerik:GridDropDownColumn DataField="fk_title_id" HeaderText="title" DataSourceID="SqlDataSourceTitle"
                            ListTextField="title" ListValueField="id" ColumnEditorID="ce_fk_title_id" UniqueName="fk_title_id"
                            Visible="false">
                        </telerik:GridDropDownColumn>
                        <telerik:GridBoundColumn DataField="username" UniqueName="username" HeaderText="UserName"
                            SortExpression="username" ColumnEditorID="ce_username">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="password" UniqueName="password"   HeaderText="PassWord"
                            Visible="false" ColumnEditorID="ce_password">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="name" UniqueName="name" Visible="false" HeaderText="Name"
                            ColumnEditorID="ce_name">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="surename" UniqueName="surename" Visible="false"
                            HeaderText="SureName" ColumnEditorID="ce_surename">
                        </telerik:GridBoundColumn>                      
                        <telerik:GridDropDownColumn DataField="sex" HeaderText="Sex" DataSourceID="SqlDataSourceSex"
                            ListTextField="sex" ListValueField="id" ColumnEditorID="ce_sex" UniqueName="sex"
                            Visible="false">
                        </telerik:GridDropDownColumn>
                        <telerik:GridMaskedColumn DataField="mobile_phone1" UniqueName="mobile_phone1" Visible="false"
                              HeaderText="Mobile Phone1" ColumnEditorID="ce_mobile_phone1" mask="### ### ## ##" />
                    <telerik:GridMaskedColumn DataField="mobile_phone2" UniqueName="mobile_phone2" Visible="false"
                              HeaderText="Mobile Phone" ColumnEditorID="ce_mobile_phone2" mask="### ### ## ##" />
                     <telerik:GridMaskedColumn DataField="phone" UniqueName="phone" Visible="false"
                              HeaderText="Telefon" ColumnEditorID="ce_phone" mask="### ### ## ##+###" />
                
                         <telerik:GridMaskedColumn DataField="fax" UniqueName="fax" Visible="false"
                              HeaderText="Fax" ColumnEditorID="ce_fax" mask="### ### ## ##" />
                        
                        <telerik:GridBoundColumn DataField="email" UniqueName="email" Visible="false" ColumnEditorID="ce_email"
                            HeaderText="E-Mail">
                        </telerik:GridBoundColumn>
                        <telerik:GridButtonColumn ConfirmText="Delete?" ConfirmDialogType="RadWindow"
                            ConfirmTitle="Delete" ButtonType="ImageButton" ImageUrl="img/app/delete16.png"
                            CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
                            <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                        </telerik:GridButtonColumn>
                    </Columns>
                </MasterTableView>
                <SortingSettings SortToolTip="Sırala" />
                <ValidationSettings EnableValidation="False" />
                <ClientSettings EnableRowHoverStyle="true">
                    <ClientEvents OnRowDblClick="RowDblClick" />
                    <ClientEvents OnPopUpShowing="PopUpShowing" />
                    <Selecting AllowRowSelect="True" />
                </ClientSettings>
            </telerik:RadGrid>
            <telerik:GridDropDownListColumnEditor ID="ce_fk_title_id" runat="server" DropDownStyle-Width="110px" />
            <telerik:GridTextBoxColumnEditor ID="ce_username" runat="server" TextBoxStyle-Width="150px" />
            <telerik:GridTextBoxColumnEditor ID="ce_password" runat="server" TextBoxStyle-Width="150px" TextBoxMode="Password"  />
            <telerik:GridTextBoxColumnEditor ID="ce_name" runat="server" TextBoxStyle-Width="150px" />
            <telerik:GridDropDownListColumnEditor ID="ce_sex" runat="server" DropDownStyle-Width="110px" />
            <telerik:GridTextBoxColumnEditor ID="ce_surename" runat="server" TextBoxStyle-Width="150px" />
            <telerik:GridMaskedColumnEditor ID="ce_mobile_phone1" runat="server" MaskedTextBox-Width="150px"  />
            <telerik:GridMaskedColumnEditor ID="ce_mobile_phone2" runat="server" MaskedTextBox-Width="150px"  />
            <telerik:GridMaskedColumnEditor ID="ce_phone" runat="server" MaskedTextBox-Width="150px"  />            
            <telerik:GridMaskedColumnEditor ID="ce_fax" runat="server" MaskedTextBox-Width="150px"  />
            <telerik:GridTextBoxColumnEditor ID="ce_email" runat="server" TextBoxStyle-Width="150px" />
            <telerik:RadWindowManager ID="RadWindowManager1" runat="server"  />
        </fieldset>
    </div>
    <div class="properties_container">
        <fieldset>
            <legend>
                <img alt="Kullanıcı Ayarları" src="img/user_management/properties32.png" />Özellikler</legend>
        </fieldset>
    </div>
</div>
<asp:SqlDataSource ID="SqlDataSourceCompany" runat="server" ConnectionString="<%$ ConnectionStrings:connectionString %>"
    ProviderName="System.Data.SqlClient" SelectCommand="sp_select_company_cmb" SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSourceUsers" runat="server" ConnectionString="<%$ ConnectionStrings:connectionString %>"
    ProviderName="System.Data.SqlClient" SelectCommandType="StoredProcedure" SelectCommand="sp_select_user"
    InsertCommandType="StoredProcedure" InsertCommand="sp_create_user" DeleteCommandType="StoredProcedure"
    DeleteCommand="sp_delete_user" UpdateCommand="sp_update_user" UpdateCommandType="StoredProcedure">
    <SelectParameters>
        <asp:ControlParameter Name="CompanyID" PropertyName="SelectedValue" ControlID="cmb_Company" />
    </SelectParameters>
    <DeleteParameters>
        <asp:Parameter Name="id" Type="Int64" />
    </DeleteParameters>
    <InsertParameters>
        <asp:Parameter Name="username" Type="String" />
        <asp:Parameter Name="password" Type="String" />
        <asp:Parameter Name="name" Type="String" />
        <asp:Parameter Name="surename" Type="String" />
        <asp:Parameter Name="sex" Type="String" />
        <asp:Parameter Name="mobile_phone1" Type="String" />
        <asp:Parameter Name="mobile_phone2" Type="String" />
        <asp:Parameter Name="phone" Type="String" />
        <asp:Parameter Name="fax" Type="String" />
        <asp:Parameter Name="email" Type="String" />
        <asp:ControlParameter Name="fk_company_id" PropertyName="SelectedValue" ControlID="cmb_Company" />
        <asp:Parameter Name="fk_title_id" Type="Int32" />
    </InsertParameters>

4 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 22 Jul 2010, 03:54 PM
Hi kerim,

In order to achieve your goal, you can handle the InsertCommand/ItemCommand event and there encode the password entered. Then try setting the encoded value as DefaultValue for the DataSource control corresponding InsertParameter.

Try it out and let me know if it works.

Regards,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
kerim
Top achievements
Rank 1
answered on 25 Jul 2010, 04:12 PM
how i can handle  InsertCommand/ItemCommand event ?? cn u give me an example  ?
0
kerim
Top achievements
Rank 1
answered on 25 Jul 2010, 06:00 PM
hi lana,

i can handle now but i cant give default value.. encoded password...  i cant take text in Password column editor.. at my popup edit form.. for encoding ..
0
kerim
Top achievements
Rank 1
answered on 25 Jul 2010, 06:15 PM
hi again..

i found the solution.. here is the code... thx for your help lana ...

Protected Sub RadGridUsers_InsertCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGridUsers.InsertCommand
    Dim passencod As New PasswordEncode       
    If TypeOf e.Item Is GridEditFormItem AndAlso e.Item.IsInEditMode Then
        Dim editItem As GridEditFormItem = DirectCast(e.Item, GridEditFormItem)
        Dim txtbx1 As TextBox = DirectCast(editItem("password").Controls(0), TextBox)
        txtbx1.Text = passencod.EncodePassword(txtbx1.Text)
    End If
End Sub
Tags
Grid
Asked by
kerim
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
kerim
Top achievements
Rank 1
Share this question
or