.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Detailsview into a new dim

Posted By:      Posted Date: October 27, 2010    Points: 0   Category :ASP.Net


I want to take some information that is in my detailsview and put it in an email.  I can get it to work with formview fields but it won't work with a details view.  basically i want to pull the id value from the details view and be able to send it out as part of an email through the code behind page after insert is executed.

'Detailsview from default.aspx
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
                    BackColor="White" DataKeyNames="id" DataSourceID="ObjectDataSource1" 
                    Height="50px" style="text-align: left" Width="300px" BorderColor="Black" 
                    BorderStyle="Solid" ForeColor="Black">
                        <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" 
                            ReadOnly="True" SortExpression="id" />
                        <asp:BoundField DataField="Requestor_Email" HeaderText="Requestor_Email" 
                            SortExpression="Requestor_Email" />
                        <asp:BoundField DataField="D

View Complete Post

More Related Resource Links

Master-Detail with the GridView, DetailsView and jQuery's ThickBox

One more article about grids from Matt Berseth. This time he shows how to create master-detail with the gridview, detailsview and jQuery's ThickBox. He writes:
So I thought I would check some of this out and along the way rebuild my Master-Detail with the GridView, DetailView and ModalPopup Controls and replace the ModalPopup with jQuery's ThickBox. I found it pretty interesting - read on to see how it went

get edited value from detailsview


hi sir/madam,

im using asp.net 3.5 sp1 and tried to search the internet but could not find any answer, i have a problem with detailsview as below, when user click on btnEdit, it will call detailsview.changemode(edit) and then allow user to enter data into the textbox, after that user will click on btnsave and then to read the value from txtname and process the value. my question is how do i get the value from txtname? i dont want to use any datasource component and i have tried call the DetailsView1.FindControl("txtname") and it returned txtbox with empty text. hope your can give me some clue where did i missed out.

any helps will be appreciated, thanks.

      <asp:DetailsView ID="DetailsView1" runat="server"  Height="50px" Width="125px" >
<asp:TextBox ID="txtname" runat="server" Text='<%# Bind("name") %>'></asp:TextBox>
<asp:Button ID="btnEdit" runat="server" Text="

Detailsview clears filled in fields


I have a details view on my page that has a template field in it. In the template field is a button that when clicked, sets the visible property of another field to true. When this happens the whole detailsview resets and anything that was entered into other fiields is cleared. Is there any way to prevent the other fields from being cleared when the hidden field is set to be shown. 

what am i doing wrong with this objectdatasource that the DetailsView never gets populated


I want to allow the user to view and edit their information.

So using another example i found online, i got it work, but the example was setup for you to provide the user name and search for the person, since you are already logged into the system i want to pass your username into the code so that on page load the DetailView is populated with your details.

                      <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="UserName" DataSourceID="ObjectDataSource2" Width="400px">
                                <asp:BoundField DataField="PasswordQuestion" HeaderText="PasswordQuestion" ReadOnly="True" SortExpression="PasswordQuestion" />
                                <asp:BoundField DataField="UserName" HeaderText="UserName" ReadOnly="True" SortExpression="UserName" />
                                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                                <asp:BoundField DataField="CreationDate" HeaderText="CreationDate" ReadOnly="True" SortExpression="Cre

Weird problem in Detailsview - Dropdownlist in



I'm new in this forum and I really hope you'll be able to help me.

I converted a field in the detailsview into a template field and put a dropdownlist in the <InsertItemTemplate> and it worked great. This is the code I put:

<InsertItemTemplate><asp:DropDownList runat="server" DataSourceID="sdsGenresPossible" DataTextField="Genre"  DataValueField="Index" SelectedValue='<%# Bind("Genre") %>' ></asp:DropDownList></InsertItemTemplate>

Now, I tried to do the same thing for the <EditItemTemplate> . This is the code I put there:

<EditItemTemplate><asp:DropDownList runat="server" DataSourceID="sdsGenresPossible" DataTextField="Genre" DataValueField="Index" SelectedValue='<%# Bind("Genre") %>' ></asp:DropDownList></EditItemTemplate>  

When I change the DV properties I do see that a dropdownlist was  added but when I run the program and click on "Edit" in the DV nothing happens (however when I click on "Insert" it works fine).

This is the Select command for the data source I used:

<asp:SqlDataSource runat="server"

DataList and DetailsView problem

I have a problem hooking up the datalist to the details view. I know everything server side is fine cause the default values work, but I guess I am not getting post back from the datalist. Here is my code.<div id="thumbnail">                     <asp:DataList ID="DataList1" runat="server" DataSourceID="ObjectDataSource2"                          RepeatDirection="Horizontal" DataKeyField="ItemsID">                         <ItemTemplate>                             <asp:ImageButton ID="Image1" runat="server" ImageUrl='<%# "Handler.ashx?ItemsID=" + Eval("ItemsID")%>'/>                             <asp:Button ID="button1" runat="server" Text='<%# Eval("ItemsID") %>' />                         </ItemTemplate>                     </asp:Dat

Passing data from a DetailsView to an Applet

I have a DetailsView that I am trying to use to pass results to an applet's parameter list but I can't figure it out. Example: <asp:DetailsView ID="..."....     <Fields>         <asp:boundfield Datafield="Name".../>         <asp:boundfield Datafield="Name2".../>          ...etc.   <applet codebase="http:/..." ...> param name="Name" value="value of Name from my DetailsView" /> param name="Name2" value="value of Name2 from my DetailsView" /> ...etc. I have been trying all sorts of things and viewing tutorials, etc, but I just don't seem to be able to figure this out.        

Get value of a label control inside the DetailsView

Hi everyone, I have a databound label control (i.e. Label 3) inside an Item Template that's in a DetailsView control. I just need to get the value of those label and compare it to some string. I tried several ways (i.e. Find control, DetailsView.Row) but nothing seems to work. I don't know if I'm using the FindControl methos correctly or if I need to access the Row first and do the findcontrol method.  Protected Sub DetailsView4_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles DetailsView4.DataBound 'If (DetailsView4.Rows(2).Cells(1).ToString = "Regular") Then 'Label3.ForeColor = Drawing.Color.Azure 'End If 'Dim StatusQualifierContainer As Label 'Dim S As String 'StatusQualifierContainer = DetailsView4.FindControl(Label3.Text) 'S = StatusQualifierContainer.Text 'If S = "Regular" Then 'Label5.ForeColor = Drawing.Color.Aqua 'End If 'Dim C As Label = DetailsView4.FindControl("Label3") 'If C.Text = "Regular" Then 'Label3.ForeColor = Drawing.Color.DarkBlue 'End If 'Dim headerRow As DetailsViewRow = DetailsView4.HeaderRow 'Dim lblText As Label = CType(headerRow.FindControl("Label3"), Label)

need to link multiple detailsview to page from one master detailsview

I am trying to arrange the information from a SQL record into a 3 column by 3 row table to fit  the form presentation that I want. I have placed on the page 3X3 table and then tried to place a detailsview in the first cell for the first picture called P1dv. I have place a detailsview in the last cell that would control the paging of information called Controldv. I need to fiqure out how to link P1dv paging to Controldv page action. I am using visual web dev. 2005. I am not updating or editing these are read only views.  All help is greatly appreciated.  example of what i need the form output to look like:     picture1   picture2  picture3     name1     name2     name3     Contact1   contact2  contact3what i have coded as of now:asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ContactConnectionString %>" SelectCommand="SELECT * FROM [driveinfo] ORDER BY [Updated_on] DESC"></asp:SqlDataSource>    <table style="width: 827px; height: 339px"> <tr> <td align="

Detailsview based on choice of dropdowns

I have a database table of managers containing the fields manager id and manager name along with some other information. I want one screen that has two dropdownlists - one for manager id and one for manager name. I want to populate detailsview after the user has chose manager id OR manager name. I do not know how to set up the datasource for the detailsview since the user could select from either dropdown.  

Issue accessing textbox controls nested within a DetailsView within an UpdatePanel

I have a couple of textboxes nested with a detailsview, within an updatepanel.  When I try and access them from the code behind, it returns a null value as if they don't exist.  Can't figure out why that would be.ASPX code is: <asp:UpdatePanel ID="upSpecificShout" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true" > <ContentTemplate> <asp:DetailsView ID="dvSingleShout" DataSourceID="sdsSingleShout" runat="server" AutoGenerateRows="false" OnDataBound="SetDVIcons" HeaderStyle-CssClass="noDisplay" > <EmptyDataTemplate> <p class="Watermark"> The panel on the left shows a list of everything you've shouted. (Your replies to other shouts are highlighted in blue/green.) </p> <p class="Watermark"> This right hand panel will show specific shouts with a list of replies etc.. Just do a little click on a shout title to display more detail here. </p> <p class="Watermark">

pass selected keyname to detailsView

Hello EveryoneI have a gridView and DetailsView.gridView.enabledselection=true. when I select a row I want to display that record in DetailsView.Can someone tell me how to di it?I have done it previously but after lot of php coding, I forgot it :S  can someone remind it to me?there is something datakeyname or something like this  parameters to specify

Detailsview edit not saving

Hello! I would like to edit a record in detailsview and it's not working. After I click "edit" it show the view in edit mode and if I change anything and click save no error is returned; just detailsview in "read/only mode", but without changes. This is the aspx code: <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">     <h2>         Urejanje kontaktnih podatkov     </h2>     <p>         <asp:TextBox ID="txtKontaktID" Visible="false" runat="server"></asp:TextBox>         <asp:SqlDataSource ID="SqlDataSource1" runat="server"              ConnectionString="<%$ ConnectionStrings:testConnectionString %>"              ProviderName="<%$ ConnectionStrings:testConnectionString.ProviderName %>"              SelectCommand="SELECT tblKontakt.*, tblStranka.strSkrajsanNaziv FROM tblKontakt INNER JOIN tblStranka ON tblKontakt.StrankaID = tblStranka.StrankaID                        

Validation on detailsview that contains both dynamic and standard controls?

I have a form that, originally, contained only dynamic controls. Validation worked perfectly, all in one spot.Today I changed three of the controls to cascading dropdown lists, two of them being required fields.After adding a RequiredFieldValidator for the two required fields, it's as though I have two separate validation events:1. Dynamic field validation - any errors show up in validation summary, and after all are resolved, no longer appear2. Required field validation - do not appear in validation summary until after all dynamic fields are validatedA user could press submit, and be alerted of one or more validation errors from the dynamic fields. Then, after resolving all those, the user would THEN see the RequiredFieldValidator messages in the validation summary. That would be understandably frustrating.Aside from using non-dynamic validation & RequiredFieldValidator for each field ... is there any way to have one validation sequence?Hope this makes sense.Thank you!

How come I can't set focus to a textbox in DetailsView?

Here's the first part of a DetailsView control definition:          <asp:DetailsView ID="DetailsView1" runat="server" DefaultMode="Edit" AutoGenerateRows="False" Width="100%" BorderColor="Silver">            <RowStyle Height="25px" />            <Fields>              <asp:TemplateField HeaderText="Name" SortExpression="Name">                <EditItemTemplate>                  <asp:TextBox ID="textBoxName" runat="server" Text='<%# Bind("Name") %>' CssClass="detailsTextBox" onclick="SelectText2(this)" onKeyUp="EnableSubmit()" />                </EditItemTemplate>                <InsertItemTemplate>        &nb

Cascading DropDownLists in DetailsView

Hi guys,My first post ;]I am a beginner in asp.net and therefore, cause problems that for me seem unsolvable.I hope someone can help me resolve this. Thank you.Here is the case:I use Visual Studio 2008 ASP.NET 3.5I have a DetailsView control with several fields that is in insert mode. Three of them are the source of my problems and headaches.I have three DropDownLists in template fields.The first one is OK, bound to it's designated field in table1 in the database. The next two however have to change their bound tables according to the SelectedValue. So far, I've managed to get it working, BUT when I insert the data I've entered, these two DropDownLists are not entered into the database.DropDownList3 - the list that controls the other two DDLsDropDownList4 and DropDownList5 - the list that need to change their items accordinglyDropDownList3 has six different values, so I have 6 tables for each of the other two DDLs However I have only tried with one to see if it would work, that's why the Sub seems incomplete.Here is the relevant part of the code: <asp:TemplateField HeaderText="Category" SortExpression="category"> <EditItemTemplate> <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("category") %>'></asp:T

DetailsView get key after insert

Hello!I'm trying to catch (in string "s") the primary key for the record being inserted via DetailsView. I have an SqlDataSource connection to an Access 2003 database. The primary key is auto-increment integer (long) field.Code:protected void SqlDataSource1_Inserting(object sender, SqlDataSourceCommandEventArgs e) { OleDbParameter insertedKey = new OleDbParameter("@KontaktID", OleDbType.Integer); insertedKey.Direction = ParameterDirection.Output; e.Command.Parameters.Add(insertedKey); } protected void SqlDataSource1_Inserted(object sender, SqlDataSourceStatusEventArgs e) { DbCommand command = e.Command; string s = command.Parameters["@KontaktID"].Value.ToString(); }generates an error:System.Data.OleDb.OleDbDataAdapter internal error: invalid parameter accessor: 12 BADBINDINFO.I can not figure out what I'm doing wrong??Thx in advance!
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend