Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Bind data to BoundFiled of a DetailsView

Posted on 2007-04-05
5
Medium Priority
?
1,198 Views
Last Modified: 2008-01-09
I would like to autopopulate the Password Field and make it only read only on a dataview.

I already have the script to make the password I just need to know how to bind it to the password filed my dataview looks like

  <asp:DetailsView AutoGenerateRows="False" DefaultMode="Insert" DataKeyNames="UserID" DataSourceID="SqlDataSource4"
                                             HeaderText="" ID="DetailsView2" runat="server" Width="275px" >
                                             <Fields>
                                          <asp:BoundField Visible=True DataField="Name" HeaderText="Name" ReadOnly="false" SortExpression="Name" />
                                          <asp:BoundField DataField="EMail" HeaderText="EMail" SortExpression="EMail" />
                                          <asp:BoundField DataField="Username" HeaderText="Username" SortExpression="Username" />
                                           <asp:BoundField DataField="Password" HeaderText="Password" SortExpression="Password" />
                                          <asp:CheckBoxField DataField="PrimaryC" HeaderText="Primary" SortExpression="PrimaryC" />
                                          <asp:CommandField ShowEditButton="True" ShowInsertButton="True" />
                                        </Fields>
                                      </asp:DetailsView>
0
Comment
Question by:jui2ce
[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
5 Comments
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 18862576
if you are getting your data from a database using the SqlDataSource you can use the BoundField property "ReadOnly" like this

 <asp:BoundField DataField="Password" HeaderText="Password" SortExpression="Password" ReadOnly="True"  />

Good luck
Sammy
0
 

Author Comment

by:jui2ce
ID: 18862596
No the problem is I have a function to Create the password. So before I do the insert I want to fill the password textbox with my random password giving them the option to change it or keep the random password.
0
 
LVL 27

Accepted Solution

by:
Sammy Ageil earned 2000 total points
ID: 18862633
In that case you can use an item template instead of the BoundField
you can see a walkthru
http://msdn2.microsoft.com/en-us/library/bb288034.aspx
all you need is set a label to hold the password and you can get it by setting the text property of the field to your script "the one generating the password"
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

705 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