Solved

DetailsView Control

Posted on 2006-10-30
3
292 Views
Last Modified: 2012-05-05
I have a detailsview control on my page.  The purpose of this control (for now) is to perform inserts on a table.

However, I want to run a function against one of the elements before the submit happens.

IE - I have a field for password.. I want to hash that password using a public function called passwordHash(string pwdToHash).

so > Input password > click insert > run passwordHash() > save to database

How do I do that?
0
Comment
Question by:dstark
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
gangwisch earned 125 total points
ID: 17836479
here's a suggestion:

  Sub CustomerDetailView_ItemCommand(ByVal sender As Object, ByVal e As DetailsViewCommandEventArgs)
   
        If e.CommandName = "Add" Then

            ' Add the current store to the contact list.
     
            ' Get the row that contains the store name. In this
            ' example, the store name is in the second row (index 1)  
            ' of the DetailsView control.
            Dim row As DetailsViewRow = CustomerDetailView.Rows(1)
            Dim mycell As String = row.Cells(1).Text
row.cells(1).text=passwordhash(mycell)
       
        End If
   
    End Sub
0
 
LVL 1

Author Comment

by:dstark
ID: 17836835
I think this is close..

However, rows.Cells(1) is returning nothing. . rows.Cells(0) is returning the "Password", but it looks like rows.Cells(1).Text is return the text of the <td> and not the textbox control that has the data..

If that makes any sense..

Any advice?
0
 
LVL 1

Author Comment

by:dstark
ID: 17836992
protected void DetailsView1_ItemCommand(object sender, DetailsViewCommandEventArgs e)
    {
        if (e.CommandName == "Insert")
        {
            DetailsViewRow row = DetailsView1.Rows[1];
            TextBox tmpPwdBox = row.Cells[1].Controls[1] as TextBox;
            string tmpPwd = tmpPwdBox.Text;
            tmpPwdBox.Text = passwordHash(tmpPwd);          
        }
    }

Not the prettiest, but it seems to work.. I posed it here incase I ever need it again.
Thanks for help.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question