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


Top 5 Contributors of the Month
Jean Paul
satyapriyanayak
SP
Ashutosh Jha
Simon Robert VoIP
Post New Web Links

Datalist - Can not set it on 'edit' mode

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

Even though I searched for a similar posting (and couldn't find it), I am certain that someone must have raised this question in the past.

I am relatively new to the .net world and I am using VS2010/SQL Server 2008. I can't seem to find the problem, but when I click on the "edit" button I get a postback but I get the ItemTemplate again.

I would really appreciate it if I can get some help with this. Thank you.

 

                <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1" DataKeyField="MessageId" >
                    <ItemTemplate>
                        Subject<br />
                       <asp:TextBox ID="SubjectTextBox" Text='<%# Eval("Subject") %>' runat="server" Width="500px"></asp:TextBox><br /><br />
                        Message<br />
                        <asp:TextBox ID="MessageTextBox" Text='<%# Eval("Message") %>' runat="server" Width="500px" Height="250px" TextMode="MultiLine"></asp:TextBox>
                        
                        <p class="right"><asp:Button ID="EditButton"


View Complete Post


More Related Resource Links

Moved from WinXP to Win7 - don't see choice to open file in read only or edit mode

  

I just recently moved from Win XP Pro SP3 to Win 7 32-bit Pro. I am logging into domain X normally. Our Sharepoint 2007 server authenticates only on domain Y. So I start Internet Explorer with "run as different user" and provide my domain Y credentials. All fine. 

In win XP, after I did this, when I click on an Excel file on Sharepoint, I would get a dialog asking if I wanted to check out and edit or open as read only. 

In win7, I don't get that choice. The file simply opens, and I get a bar at the top which allows me to check out the file if I wanted to. 

How can I restore the functionality I used to have, with the dialog for checking out the file before opening it?


Not always prompted for read-only or EDIT mode, when opening files with IE7, Sharepoint 3.0

  
Hello Everyone,   We use Sharepoint 3.0 and when I click on a document I get a pop up prompt that asks me whether I want to open the file in READ-ONLY or EDIT mode.   I use a machine with XP Pro that is running IE7.   A user called me today, also running IE7, and when he clicks to open a Sharepoint file he gets a different prompt - a simpler one that just offers OPEN or SAVE.   I don't care that his prompt looks different - the problem is that he is able to open the file, make edits, but then when he closes the file (using Excel) he isn't able to save his changes.   Excel only provides a save-as option for him.   This isn't a permission problem with his ID.   When I login to our Sharepoint 3.0 system as him, with his password (from my machine), I get the usual Read-Only / Edit prompt and when I open a file in EDIT mode I am able to save my changes with no problem.   Any thoughts on this?   Chris

Accessing a row's dropdownlist values AFTER the gridview control is in Edit mode

  
Hello, I have a gridview control. When it goes into Edit mode, there are 3 dropdownlists in one cell that are populated by separate stored procedures during the RowDataBound event. The 1st dropdownlist's value is used as a parameter to determine what the 2nd dropdownlist is populated with. The 2nd dropdownlist's value is used as a parameter to determine what the 3rd dropdownlist is populated with. Everything works fine when the row is first put into Edit mode. While I'm in Edit mode and I change the selection in the 1st dropdownlist, how do I access the control so I can feed this new parameter to the 2nd dropdownlist? I have the first 2 dropdownlists set for AutoPostBack so that the Page_Load event is fired when the user changes a value. I know how to get access to these controls via the FindControl method when the row is being databound but how do I find the control during the Page_Load event? Thanks for any help!!!   Penny  

Need more font size options in browser edit mode

  
Is there a way to have a different font size other than the drop down menu of Editing Tools > Format Text of: 8, 10, 12, 18, 24, 36, 48, 72 pt ?   As a designer, I feel handcuffed with just these options. 

Gridview edit mode - What event does enter key call?

  
I have sort of a very specific problem.  I have a gridview with a few different template columns and a commandfield with the standard "edit" link.  There is no sqldatasource associated with it at all.  In the code, I pull some data from an sql database into a datatable and set the gridview's datasource to be the datatable.This all works fine.  When I hit the "edit" button, the standard textbox shows up where it needs to so that I can edit the data.  The problem is the updating portion.  I have programatically removed the "update" button and left the "cancel" button for design reasons. I want the user to be able to hit "enter" in order to update the data in the data table.  Then, when they're ready, they can click a submit button which will extract the data from the datatable and update the database.I'm having trouble with this 'enter key' business.  When you edit the data and hit "enter" while in edit mode, the page posts back, and the previous values are placed in the gridview.  What event was just  called?  I need a way to take what the user put in and place it in my datatable.  What are my options?Thank you. 

hide EDIT mode from the ribbon

  
Hi, I am creating a page in SPD 2010 contain custom form that insert items in a list (Poll).  the problem is when i browse the page, by default the ribbon goes to the edit mode. please see the snapshot http://www.exceeditacademy.com/pdf/issue.jpg my question is: - how to force Ribbon to go to the browse mode dirrectly ? or - How to hide the edit mode from the ribbon ? thx

Have templatefield in edit mode and datasource defined in code behind

  
Is this possible? Some sample code:<asp:GridView ID="gvConcerns" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None"> <RowStyle BackColor="#EFF3FB" /> <Columns> <asp:TemplateField HeaderText="Number" Visible="true" SortExpression="Number"> <EditItemTemplate> <asp:Label ID="lblEditNo" runat="server" Text='<%# Eval("number") %>'></asp:Label> </EditItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Part" Visible="true" SortExpression="part"> <EditItemTemplate> <asp:Label ID="lblEditPart" runat="server" Text='<%# Eval("part") %>'></asp:Label> </EditItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="List" Visib

Want to show FormView in Edit mode with specific table columns depending on their Genre??

  
hi, I have  a table in my database called "Profiles". This holds data on Female and Male personal characteristics. On my aspx, I have a formview in edit mode which is binded to an object data source with a GetDataByUserId Select method which retrieves data from the "Profiles" Table via a DAL. The "Profiles" table has some columns which relates to females only and some just males and some are generic to both. See example below     UserId - / of Type GUID GenreId /  of Type BOOL. Hip Size (For females) Dress Size ( For Females) ChestSize (For Men ) TrouserSize (For Men) Weight ( For both )   When the User logs in , they go to an update Page which has the Formview in Edit Item Mode and contains drop down Lists which are binded to the Users Selected Value. The DDL are in turn bound to their related table such as HIP, Dress, Chest, Trouser etc. Objective If a female user logs in I just want to show them the (Hip Size) DDL  and DressSizeDDL in the Edit item template of the formview and not the ChestSize DDL or  TrouserSize DDL. At present the GetProfileByUserId returns all colums from the table My question is how do I do this and just show DDL which are relevant to the Female or Male Only. In some cases the user may not have selected an item in the previous form so they could also be

Populate textbox in FormView Control in Edit Mode with querystring

  
Can someone please tell me what I am doing wrong here. I am simply trying to get a querystring value and pass it to a textbox in a formview with the default view set to edit mode.     Protected Sub fv_Detach_Engine_DataBound(ByVal sender As Object, ByVal e As EventArgs) Handles fv_Detach_Engine.DataBound        If fv_Detach_Engine.CurrentMode = FormViewMode.Edit Then            Dim tbx_IDProfileAccount As TextBox = TryCast(fv_Detach_Engine.FindControl("tbx_IDProfileAccount"), TextBox)            If tbx_IDProfileAccount Is Nothing Then                tbx_IDProfileAccount.Text = Request.QueryString("IDProfileAccount")            End If        End If    End Sub  

DetailsView error "must be in edit mode to update a record" when I have set edit mode in code behind

  
Hi,I have a DetailsView within an UpdatePanel.  I programmatically put the DetailsView into edit mode, change the fields then call the UpdateItem method which causes the "must be in edit mode to update a record" exception.  Am I missing something blindingly obvious? <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" DefaultMode="ReadOnly" AutoGenerateEditButton="true" OnItemCommand="dvItemCommand"> <fields> <asp:TemplateField ShowHeader="false"> <ItemTemplate> <asp:Panel ID="dlSpecificDetailsViewPanel" runat="server" CssClass="i_am_a_shout"> <h2><asp:LinkButton ID="lblShoutTitle" runat="server" Text='<%# Bind("Shout_Title") %>' On

Put outer-gridview in non-Edit mode when user edits inner-Gridview

  
using vb.net/asp.net 2005.(sorry last post I had the grids reversed, what I meant to say is this:I have an outer gridview I'll called "Outer" and an inner-gridview inside that I'll call "inner".There are times when the user will put Outer into edit mode and then put Inner into edit mode and change a value in Inner.  The user is not supposed to be able to do that.So when the user wants to edit Inner I need to change the edit mode of Outer so that Outer is Not editable.   EX: I want to do something like this but not sure in which event of outer to do it:'event fired when user puts inner gridview into edit mode Protected Sub Inner_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles Inner.RowEditing 'put outer gridview into non-edit mode Outer.EditIndex = -1 End Sub Does anyone know how to do this, is this the right event?  Also I assume I have to rebind the gridview?thanks,MC

How to put a TreeNode into Edit mode and make the text unselected

  
I have a c# app in which I would like to allow the user to enter new nodes in a TreeView control without having to use the mouse. I am able to intercept keystrokes in OnKeyDown, and the following code is working successfully: TreeNode newNode = new TreeNode( e.KeyData.ToString() ); Nodes.Add(newNode); LabelEdit = true; newNode.BeginEdit(); The problem is that the first letter in the node being edited is selected, which causes the following keystroke to replace the selected character.  Typing "HELLO" results in "ELLO", unless the user first presses the right-arrow key to deselect the selected first character. I tried setting e.Node.IsSelected = false in OnBeforeLabelEdit, but cannot because the IsSelected property is read-only. How can I programatically deselect the first character and position the edit cursor after the first character?

WPF DataGrid TemplateColumn does not go into edit mode when tabbed to.

  
I am using a TemplateColumn with the WPFToolKit DataGrid.  When I tab thru the other columns when in edit mode the cells go right into edit mode, but when I hit the cell with the TemplateColumn I have to click the tab twice to get into edit mode.

 

 

<tkit:DataGridTemplateColumn>
  <tkit:

Populate dropdownlist in Edit mode programatically

  

I'm trying to programatically populate some dropdownlists inside a formview in EDIT mode, like this below.


 Dim FVM As String = FormViewMemberProfile.CurrentMode.ToString

        If FVM = "Edit" Then

            Dim ddlDays As DropDownList = CType(FormViewMemberProfile.FindControl("ddlDays"), DropDownList)
            Dim ddlYears As DropDownList = CType(FormViewMemberProfile.FindControl("ddlYears"), DropDownList)

            Dim i As Integer = 1

            For i = 1 To 31
                ddlDays.Items.Add(i)
            Next


            Dim k As Integer

            For k = 1930 To 2008
                ddlYears.Items.Add(k)
            Next

        End If


I orginally had this running as part of the pagelaod event, but I'm thinking that b/c the page loads first, it doesn't populate the fields in EDIT mode until after the data is saved, and then page is reloaded. Now it knows it's in "Edit" mode. Am I thinking clearly here? Not sure if this is the order of things... Anyhow...

So I thought I should just use a formview_modechanged (or similar event) so when the user switches modes, it populates the fields - but I'm not sure which event I should use. I've tried "Modechanging", "modechanged", "prer

Categories: 
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