.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

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

Posted By:      Posted Date: September 08, 2010    Points: 0   Category :ASP.Net
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

View Complete Post

More Related Resource Links

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  

Switch FormView to Edit Mode from Repeater ItemCommand


The following code successfully displays a record in a FormView and sets the FormView mode to 'Edit' when the user clicks on a LinkButton within a Repeater, however the record is not Updated. If I don't change the .SelectCommand and call .DataBind, I'm able to update the first record that is displayed. Naturally that's a moot point because the idea is to be able to update the record that the user selects in the Repeater. Because of the design of the FormView and Repeater, the record *must* be updated via the FormView. Updating the record via the Repeater is not an option.

    Protected Sub RepeaterMessages_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs)

        Select e.CommandName
            Case "Edit"
                SqlDataSourceMessageDetail.SelectCommand = "SELECT [Id], [MessageDateTime], [MessageOwner], [Subject], [Body], [AllowReplies], [ExpirationDateTime], [IsCityWideMessage], [DepartmentId], [BranchId], [CompanyFacilityId], [ShowNumber], [IsHighPriority], [UpdateDateTime] FROM [Messages] WHERE ID = " & e.CommandArgument

CQWP results show only in Edit Mode



I added a CQWP to aggregate all Tasks within my site collection. It all works fine in Edit Mode and the correct tasks are displayed (it shows only the current user's uncompleted tasks).

However, as soon as I Exit Edit Mode the results disappear and the Content Query Web Part tells me "No items available". I switch back to Edit Mode: the items re-appear.

Any ideas what I am doing wrong?

How to specify that FormView is in edit mode in an if-then statement


Hello, could someone please verify that the following if-then syntax is correct? I'm trying execute code only when FormView is in Edit mode ---but the code following line this is being executed even in read-only mode.  Thank you.


If formname.CurrentMode = FormViewMode.Edit Then

Basic List Definition steps - cannot get columns to show up in New, Edit, etc.


Can someplease explain (since the MSDN docs don't) all the necessary stuff required to make a custom List Definition?  I'm trying to make a List Definition and in the schema.xml I've added some custom columns, as well as existing site columns, and I cannot get anything but the default items (from VS creation itself), like Title, to show up.  Some things I've tried:

1 - Yes, "ShowInNewForm", "ShowInEditForm", and "ShowInDisplayForm" are all set to True

2 - I've tried making an inline Content Type for these new columns (i.e., not a new ContentType element, just inside the Schemal.xml file)

I cannot ever get the custom columns to ever appear on anything other than a View.  Also, how the heck do you hide/get rid of the Title column if you don't need that?


How to show column value in display mode and hide in edit mode?


How to show column value in display mode and hide in edit mode for my custom page layout?

I need similar functionality like PublishingWebControls:EditModePanel with contrary behavior.

I cannot use nor server-side code neither third-party web-parts. Only pure APSX+SP Contol Libraries and client JS allowed.

How to sort the lookup columns in edit mode?




I have a custom list "A" which has a lookup field from another custom list "B".

In the edit mode of "A", the items' order in the little pickup window is by alphabetically ascending order of that field from
"B". No matter how I change the default view's order in "B", I cannot let the field to be ordered by ID in "A"'s edit mode.


Is there any way to do that?




How to let user edit selected gridview columns, not entire row



I've got a gridview I would like to let the user edit a couple of columns.  Seems like everything I'm coming across so far makes the entire row editable.  

Hopefully the solution isn't too complicated.  Can someone point me in the right direction?


FormView -- Parameters and asp:Table


I've already solved this problem to my satisfaction, I just want to know WHY it works this way.

I have a FormView control bound to an ObjectDataSource.  Let's say our data source is a hypothetical table with three columns:  id, name, age.  Why is it that when I use the <asp:Table> element inside of the FormView, the parameter values are not set, but when I use the standard <table> tag, it works fine?

This seems like a .NET problem to me.  I expect the <asp:Table> element to work in the same way as <table> because they are, for all intents and purposes, the same thing.  Am I missing something?

Entity Data Model and database view returning the same columns as there are in a table


When adding a stored procedure into the Entity Data Model I can select whether the procedure returns a scalar, a (new) complex type or one of the entity types I already defined. 

How do I do something similar for a view?

I mean assuming I have a view like this

CREATE VIEW FilteredFoos as SELECT Foo.* FROM Foo join ... WHERE ...

(that is a view that implements some involved filtering, but returns all columns from one table) how do I add it to the project so that I can use the entity set, but get the Foo objects, not some new FilteredFoo objects.

var foos = myDB.FilteredFoos.Include("Bar").ToList();

foreach (Foo foo in foos) { ...

Thanks, Jenda

How to create scrolling table for columns in a SharePoint Designer Data View


I have a fairly complex SharePoint Designer 2007 Data View they have added two more requirements.

1. Have the columns on the right side be able to scroll left to right as there is a large number of columns, while the first 3 columns on the left side stay locked in place.  This is only one list not two, and because of some other requirements I have it must remain to be just one list.

2. Then they also need to have scrolling up and down of the entire list with the headers locked in place.

The first requirement is more important than the second, but preferrably I need to do both.

I am new to XSL so not familar with the syntax. Is this something I can do on a custom Data View? Does anyone have any examples of how?

I have a drawing that show how it needs to look but I don't see an option here to upload a graphic.

So here is a link to my graphic example uploaded to my blog area: http://lindachapman.blogspot.com/  or just the image here: http://4.bp.blogspot.com/_aB01ue__NvQ/TGL42MOvrGI/AAAAAAAAAA4/c3xP4uCy4BU/s1600/Scrolling.png

I failed to mention that 3/4 of the columns are HTML Calculated fields wh

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?

Show data in RowEditing mode


hello ,

        I have show data in gridview. when search item. And for updating We use Edit button. When I click on edit button it doesn't show data. I have also bind again data. It doesn't show data . The gridview doen't display.

        but When I enter search number again then display it.

I have paste some code snippest.

protected void gvFaxValidation_RowEditing(object sender, GridViewEditEventArgs e)

         gvFaxValidation.EditIndex = e.NewEditIndex;

         GridViewRow editingRow = gvFaxValidation.Rows[e.NewEditIndex];


         if (ddlSearchCriteria.SelectedValue == "PRESCRIBER_ID")

             gvFaxValidation.DataSource = objMasterBLL.FaxSearch(Txt_Search.Text);


DataGridView>Edit Columns> Column Read Only property is unwilling to change

Hello, I am facing the following mystery: When changing the read only property of a column to false and reopening the "edit columns" window, it mysteriously turns back to true. Even when closing the designer and changing it in the designer code, the resulting execution does not allow edit, as well as when re-opening the designer you see true again.             this.numberDataGridViewTextBoxColumn1.DataPropertyName = "Number";             this.numberDataGridViewTextBoxColumn1.HeaderText = "Number";             this.numberDataGridViewTextBoxColumn1.Name = "numberDataGridViewTextBoxColumn1";             this.numberDataGridViewTextBoxColumn1.ReadOnly = true;//False is required We thought it might be related to data binding. rebinding the grid did not help as well. The is no other place in the code where it changes. Please advice, Thanks

gridview help on each dynamic row solve this show values based on all columns

<asp:GridView style="Z-INDEX: 101; LEFT: 1px; POSITION: absolute; TOP: 183px" id="Gridview1" runat="server" Width="613px" Height="127px" ForeColor="Teal" Font-Size="12pt" Font-Names="Palatino Linotype" Font-Bold="True" Visible="False" BorderColor="Transparent" AutoGenerateColumns="false" CellSpacing="2" GridLines="None" OnRowCreated="Gridview1_RowCreated" SelectedIndex="5" ShowFooter="true" OnRowDataBound="Gridview1_RowDataBound"><Columns>  <asp:TemplateField HeaderText="ItemCode"><ItemTemplate> <asp:DropDownList id="DropDownList1" tabIndex=16 runat="server" AutoPostBack="True" DataValueField=" ItemCode " DataTextField=" ItemCode" ></asp:DropDownList></ItemTemplate></asp:TemplateField>  <asp:TemplateField HeaderText="ItemName"><ItemTemplate> <asp:DropDownList id="DropDownList2" tabIndex=16 runat="server" AutoPostBack="True" DataValueField="ItemName" DataTextField="ItemName" ></asp:DropDownList> </ItemTemplate> </asp:TemplateField>  <asp:TemplateField HeaderText="Category"&

SMO classes to generate alter table script to add columns

How to generate ALTER TABLE script to add columns using SMO and c#.

SQLCE table column DefaultValues don't show up in XSD Dataset designer

Using Visual Studio 2008 with SQL CE 3.5, I notice that default values in the creation scripts for the database tables are not reflected in the dataset designer XSD file.  For example, the following SQL script creates the non-nullable table column names "Content" with a default value of 'Image':    "Content" nchar(20) NOT NULL DEFAULT 'Image',But in the column properties of the dataset designer (XSD) panel, this column correctly shows up as non-nullable, but with a DBnull default value as follows:     Name: Content    Allow DBnull: False    DefaultValue: <DBnull>Am I missing something somewhere, or is this a VS bug?  Also, how do I get the XSD file to regenerate after schema changes in the database?  Sqlmetal doesn't do it.Thanks,    -BGood
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