.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

How to select column value from grid and hide a column?

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


I'm trying to retreive a column value from gridview5 to use it in a query to display resuls in gridview, can you please help me with the code below. Also how do you hide a column in the grid?

Where (p.Link_ID Like GridView5.?????)

Dim DB As New AOP29DBDataContext

Dim Query = From p In DB.Link_Tables _

Where (p.Link_ID Like GridView5.Columns("link_ID")

Select p.Receiver.Receiver, _

p.Donor.Donor, _


GridView4.DataSource = Query


View Complete Post

More Related Resource Links

Hide grid view column if empty

 Hello All, I want to hide a grid view column if that column is empty. How do I do this? I dont have much exp. with grids. Please help me. Thanks in advance.

Need help on Select button column in Data Grid to populate fields in Form View


 When I have a select a row in a Data Grid that when I click on it I want it to show the info for the person I selected in a form view on the same page as the Data Grid. Here are the columns for the Data Grid that I have set up, the column is highlighted:

<asp:DataGrid ID="MHGrid" AutoGenerateColumns="False"  
        DataSourceID="MHFoundation" DataKeyField="POPULATION_LIST_ID" 
        AllowPaging="True" AllowSorting="True" BorderStyle="Solid" 
        BorderColor="#999999" BorderWidth="3px" CellPadding="4" PageSize="4" 
        CellSpacing="2" runat="server" BackColor="Gray" Font-Bold="False" 
        Font-Italic="False" Font-Overline="False" Font-Strikeout="False" 
        <SelectedItemStyle BackColor="#FF9900" Font-Bold="False" Font-Italic="False" 
            Font-Overline="False" Font-Strikeout="False" Font-Underline="False" />
            <asp:ButtonColumn CommandName="Select"  Text="Select"></asp:ButtonColumn>
            <asp:BoundColumn D

WPF Data Grid - How to hide the next column/row that is visible?


I'm using a WPF data grid to bind to an object (i.e. not a database). I have the horizontal alignment on Stretch. I currently have it within a Border, which is within a Grid.

However when I run the application the DataGrid has a blank column and grid showing. That is say I have 5 columns & 5 rows, then there is a blank 6th column and row showing. See image:

alt text

Question - How can I get rid of these blank rows? Note that the contents of the DataGrid are populated programmatically (i.e. are not static).


WPF Data Grid - How to hide the next column/row that is visible?


I'm using a WPF data grid to bind to an object (i.e. not a database). I have the horizontal alignment on Stretch. I currently have it within a Border, which is within a Grid.

However when I run the application the DataGrid has a blank column and grid showing. That is say I have 5 columns & 5 rows, then there is a blank 6th column and row showing. See image:

alt text

Question - How can I get rid of these blank rows? Note that the contents of the DataGrid are populated programmatically (i.e. are not static).


Pass a grid column value to a Modal


Hi, I have a requirement to hide a field called details on a gridview and show it in a jQuery modal dialog when users click on the Customer ID hyperlink. This grid is created programmatically. I will be hiding the details column via the CSS display:none property. Does some one know how can I pass the grid's selected hidden column value to the modal? Here is some of the code I started:

            GridView mygrid = new GridView();
            //.....................................More columns code for the grid

            //Here is where I need to pass the Details column value associated with the customer ID field selected to the Modal and open the Modal dialog.            
            HyperLinkField linkField = new HyperLinkField();
            string[] dataNavigateUrlFields = { "CustomerID" };
            linkField.DataTextField = "CustomerID";

BDC Column with Ability to Select Multiple Values


Use Case:

We are creating a storage location for technical product articles. These will be SharePoint publishing pages. Each page will have metadata assigned to it to make it searchable by properties. The possible values for one of the columns (Part Number) could potentially be sourced by our ERP system. I'd like to do this to eliminate the possibility of free-text entry errors, but there are probably over 10,000 parts so a drop-down list isn't feasible.


Ideal Situation:

The end user enters the part number and clicks a button to verify it against a BDC entry from our ERP system. If they weren't sure on the part number they needed, they could do a lookup from that metadata entry screen. They'd need to have the option to add multiple part numbers as one technical product article could reference multiple part numbers.



Is BDC an option for all of this or am I looking at a custom metadata solution? I thought I heard along the way that BDC only supported one value choice, but I couldn't find a verification for that in the forums.



Use BDC data in list as multi-select column

I have a document library that uses values from another system for its metadata.  Right now, we copy the values from the primary system into SharePoint so users can choose them.  I want to find a way to use the BDC connection that I have set up to automatically pull those values.  The problem is that the current metadata is set to multi-select.  So, I have a file that is in the library and it can be used for multiple clients - clients is a column in my library and users can select many entries.  When I set up a column to pull BDC data, it only allows single entry.  Does anyone have any ideas?

wss2.0 update/delete/hide lookup column that does not display any values


Hi All,

I have a document library that contains a Category column that is a lookup field. This is a default column that is a required field when uploading documents to the document library. The Category column is empty and I am unable to amend, hide, make it not required or delete it.

I have gone to Modify settings and columns -> clicked on the Category field to edit, but there is no option to amend the content or delete it. I am only able to amend the Column name and Description.

Since then, I have amended the column name to eg. Category1 and created a new Category field as a lookup and linked it to the correct list.

The problem I am facing now, is that I cannot hide, delete or make the Category1 (old Category) field NOT required. Either I would like to update the original field to display the correct values or alternately hide, delete or make the column not required.

Please help.

Filtering a grid column when the column is bound to a collection


My SetUp (I am using EF for my data):

1 Grid bound to a collection of Vehicle Objects

1 Combobox with multiselect enabled bound to a list of VehicleExtras.

Each vehicle has a collection of extras. 

My Problem:

What I need to do is have the Grid filter Vehicles based on whether those vehicles have the selected VehicleExtras from the Combobox

Can anyone point me in the right direction as to how this filtering should be done (if it is at all possible!)



Hide data for specific column from a user

Greetings, I have a problem. I would like to restrict showing specific users (or roles or schemas) data in a column. First I thought DENY option will do it but figured out that it won't. DENY denies the column being in the SELECT query. I would still like to call the column but if access to the data in that column is restricted it would show only null values and not the real ones. So... I would like call the next query from user TestUser: SELECT ID,Name,Address FROM Employee But if access to Address is restricted for TestUser I would get results like: ID Name Address 1 John Smith NULL 2 Rick Ross NULL ... Is it possible to do something like that in SQL Server 2005/2008? I was thinking of storing that kind of information in a table (for which tables, which columns for which users access is restricted) and then manipulate it on the application site but my programmers tell me that they use components which always call the full table (like SELECT *).  Thank you for your answer.

Copy a column with update and select

Hi, I am using SQL Compact 3.5 I am trying to copy the values of a column called "CODIGO" from one table to another table. I mean, I want to copy the column "CODIGO"  from table  "DATOS_ACADEMICOS" to table "ALUMNOS". I use this code: UPDATE ALUMNOS  SET CODIGO=(SELECT DATOS_ACADEMICOS.CODIGO FROM DATOS_ACADEMICOS WHERE DATOS_ACADEMICOS.ALUMNO_ID=ALUMNOS.ID)   But I get an error in the SELECT statment: Major error 0x80040E14, Minor error 25501 [ Token line number = 2,Token line offset = 13,Token in error = SELECT ]   I also tried this code with the same error: UPDATE ALUMNOS  SET CODIGO = (SELECT DATOS_ACADEMICOS.CODIGO             FROM DATOS_ACADEMICOS             WHERE DATOS_ACADEMICOS.ALUMNO_ID=ALUMNOS.ID) WHERE EXISTS (SELECT 1 FROM DATOS_ACADEMICOS WHERE DATOS_ACADEMICOS.ALUMNO_ID=ALUMNOS.ID)   How can I copy from one column to another in a SQL sentence? Thanks    

can alias in select be used for selecting other column in that table?

Hi All,I want to use an alias name in a select clause to select other column in that table? select   top 1 (   case when CreatedByName <> '' then 'yy'         else 'xx' end) as filName, (filName + 'xx')from Order       But it throws error like " Invalid column name 'fileName'."Could you please help me out?

Grid Column in Sharepoint.

I need to create a grid column type for sales team of my company: Please have a look at following image. Grid column type in above example - this column type is just making single choices on each row - I need something which can allow various types of columns inside the grid more like a table. So that I can have columns like Qty(number), Cost(number), From Dept(drop-down), To Dept (drop-down) as column heads against the products - so all info of the products can be inside a single column (instead of multiple items in a list) and yet the info is linked row-wise i.e. qty in first row belongs to product 1 - they are linked for the purpose of filtering records later on. By the way, the responses of this form are saved in a spreadsheet like any normal google form - will email the link to this spread sheet as well. Is this possible? Are there any column features or webparts available for same? Apreciate all help!. -saumil

hide column in insert template

Hello.  I would like to hide a foreign key column in an insert template.  It is auto populated with jQuery, and it would be great if this column was also hidden from view.  How is this done?  Thank you. 

Use Data in a Column as Select Button in GridView

I don't want to use the built in "Select" hyperlink that's in the gridview, I'd like to just use the first data column, is there a way to do that or are we forced to use the automatically generated "Select" column.Thanks!

Write select query with a paremetrized where clause, and populate database with the retrieved column

I want to be able to retrieve column values using the dropdownlist values as parameters then populate the tbPO table with the retreived values. Where and how do I do it. ImportsSystem.Data.OleDb ImportsSystem ImportsSystem.IO Imports ?directcostDataSetTableAdapters PartialClass po_header  Inherits System.Web.UI.Page  Dim cn As OleDbConnection  Dim cmd As OleDbCommand  Dim dr As OleDbDataReader  Dim icount As Integer  Dim str As String  Dim vendor_id As Object   ?  Public Sub btn_click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.ClickTry   context.Items.Add(     cmd.CommandType = System.Data.   cmd.CommandText = Dim context As HttpContext = HttpContext.Current"Company_Name", DropDownList3.Text)Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Users\Owner\Documents\Visual Studio 2010\WebSites\WebSiteJun25\App_Data\directcost.mdb;")Dim cmd As New OleDbCommand()CommandType.Text"insert into tbPO(ponumber, suppliername, ShipTo, basictype, DateNeeded, Purpose,ShippingInstr, ProjId) values(?,?,?,?,?,?,?,?)" cmd.Parameters.AddWithValue( cmd.Parameters.AddWithValue( cmd.Parameters.AddWithValue( cmd.Parameters.AddWithValue( cmd.Parameters.AddWithValue( cmd.Parameters.AddWithValue( cmd.Parameters.AddWithValue( cmd.Parameters.Add

Select column from all tables in database

I want to retrieve the name and phone columns from all the tables in my database not in systables....   Ok this works but i dont want to get it from just the test table I want to get it from all the tables that I create "USE mrpoteat SELECT name, phone FROM mrpoteat.dbo.test where name = name and phone = phone"
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