.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

Use Data in a Column as Select Button in GridView

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

View Complete Post

More Related Resource Links

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

Rendering data with HTML tags in the DD Gridview for a selected column


I am having trouble finding out where and how to HTML Encode a cell's data on the Dynamic Data (v4.0) gridview of List.aspx.  As a simple case, suppose I have formatted cell data that is A<br/>B in the DB.    Obviously, I want A stacked on B in the cell.

It seems gridView1.HtmlEncode = true has gone away.

So maybe I'll try to catch it on the RowDataBound event:

protected void GridView1_RowDataBound(Object sender, GridViewRowEventArgs e)

            if (e.Row.RowType == DataControlRowType.DataRow)
                // Html Encode the cells


but this event never fires?

Has anyone figured out how to properly render HTML tags data in the List.aspx's GridView1? 

If I figure this out, then I can add a MetaAttribute called something like [EncodeAsHtml(true)] and be on my way.  Thanks!

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?

Repeater and Gridview with select button

Hello every oneI have the following issue:I have a repeater that iterates over a datasource, and each detail of the datasource has a type of control or entry method, I have an enum to represent the type of controlenum ENTRY_METHOD : byte { SINGLE_SELECT = 1, MULTIPLE_SELECT = 2, OPEN_TEXT = 3, FLEXI_SELECT = 4 }And I have this in the repeater's ItemCreated event: switch (EntryMethod) { case ENTRY_METHOD.SINGLE_SELECT: break; case ENTRY_METHOD.MULTIPLE_SELECT: break; case ENTRY_METHOD.OPEN_TEXT: break; case ENTRY_METHOD.FLEXI_SELECT: break; default: break; }This is the aspx file:<asp:Repeater ID="RptUserDefinedInfo" runat="server" OnItemCreated="RptUserDefinedInfo_ItemCreated"> <ItemTemplate> <div style="width: 30%; display: inline-block; vertical-align: top; margin: 10px;"> <asp:HiddenField ID="HddUDTypeID" runat="server" Value='<%#Eval("UDTypeID") %>' /> <asp:HiddenField ID="HddEntryMethod" runat="server&q

Select necessary data from Gridview row

Is it possible to select a row without using the SELECT hyperlink/button besides I don't want to slect the entire row instead, i can select the row of the checked radio button? Based on this example image, I just want to retrieve the data from column FROM, TO, FLIGHT and the selected radio button which is PHP 2899.00.

GridView column/row data binding problem

Hi All, I have a table with the following structure: Attribute------------- AttributeIdWeekNoDayNoAttribute1Attribute2Attribute3Attribute4Attribute5 ........ likewise. I want to display these data in a gridview in the following manner                                  Sunday    Monday Tuesday ............ (till Saturday) - should be gridview columns, I can retrieve this using dayno Attribute 1 Attribute 2 Attribute 3 Attribute 4 .......... like wise attributes should be taken in to rows.Is this possible in a gridview, if so how can I do that?

Retrieve data from select columns without creating Gridview etc??

I have an accessdatasource with multiple columns, one column I use it to populate a dropdownlist. Can I use the data from other columns to insert into a table,  insert being done in the aspx.vb page, without creating gridview etc.   Is it possible to make a detailsview one column visible= false and still be able to evaluate its contents? Thanks,

Get non data item to the Gridview ItemTemplate Button

Can somebody suggest how to get the variable value to the hyperlink postbackurlHere the code that i have in Gridview<asp:TemplateField HeaderText="Process" ShowHeader="False">            <ItemTemplate>               <asp:Button ID="Button1" CssClass="btn" PostBackUrl='<%# String.Format("http://googlemaps.com?ID={0}&Name={1}&Address={2}", Eval("No"), Label2.text, Eval("Id"))%>'                runat="server" Text="Process" OnClick="LinkButton1_Click"   />             </ItemTemplate>            </asp:TemplateField>I have ID and Address parameter coming from the dataset/Datasource but not the Name parameter.Is there a way that I can pass the non databound item to the postBackUrl query string.

hide gridview column using javascript. working in ie and firefox but In firefox, gridview data is sh


function EnableDisableGridViewColumn() {
               var AdvanceSearch = document.getElementById('<%= chkboxlist1.ClientID %>');
               var chkList = AdvanceSearch.getElementsByTagName("input");
               var dgTest = document.getElementById("gridview1")
               if (dgTest != null)
                   for (var i = 1; i < dgTest.rows.length; i++) {

                       if (chkList[0].checked == true && chkList[1].checked == true) {
                           dgTest.rows[0].cells[0].style.display = "block";

Problem with getting extra data in column of gridview


I have created a gridview based on an SQL Datasource.  The grid view contains several columns(fields) one of which is called "Amount".  In the footer of the gridview their is a field that contains the sum of all of the values contained in the "Amount" field.

By problem is that in instead of getting the value of the Amount displayed in the "Amount" field of each row, I am getting a '0' (Example: 0 25.78 when I should just be getting 25.78.  There is a space between the '0' and the '25.78'.

Code is as follows:


<asp:TemplateField HeaderText="Amount" SortExpression="Amount">

Select only one item through radi button in gridview


Hi friends i have a gridview with radio button.i need to select only one item through out gridview i have written code that is working fine but that is giving problem in paging i am displaying gridview with 5 records per page.in first page i am able to select only one item but if i move to second page here also i am able to select only one radio button in this mean time if move to first page in that page also radio button is in selected mode .How can i make only one radio button selected in through out gridview and How can i get paging data from gridview(if i select 3rd page value and i moved to first page in that situation i need to get get that 3rd page value aslo ).How can i get that data pls help me

How to Format Data inside a Bound Column of Gridview?



I have a bound column.

<asp:BoundField DataField="WorkPreference"  HeaderText="WorkPreference"
                    <HeaderStyle HorizontalAlign="Left" />

dr["WorkPreference"] = sa.WorkPreference ( This is how I bind the data  to a DataRow)

The example of the data which gets bound to this column is like the following:

Communications and Marketing Officers; Environmental Assessors; Geologists and Geosciences; Geospatial/Spatial Information Officers;

What I want is that the data should be presented to the user like the following:

Communications and Marketing Officers

Environmental Assessors

Geologists and Geosciences

Geospatial/Spatial Information Officers

In short: I basicaly want to put a break where there is a colon and then bind the data to the gridview.

It looks like simple but if you can let me know. Thanks.

Accessing data from GridView Column which is set to Visible="false"


I have four columns in gridview.   EmpId,EmpName,EmpSal,EmpDept.

I want to display the complete information on another page,for this am sending empId to other page through RowCommand.

Now I dont want to display my EmpId Column in GridView but I want to access it .. How to do this...

Thanx and regards....

Show column headers when gridview returns empty data set




I have in my code a gridview that I redirect to excel, it works fine when I have data in the data set. waht I want is to show column headers when there is no data right now what i get is empty sheet. 

Select Row on GridView by Clicking Next button



         I have a button called Next outside the GridView. If I click on Next, I want to highlite the 2nd row and display the details of the 2nd row below in panel. If again I click on Nextm i want to highlite 3rd row and want to display 3rd row results in a panel


AJAX GridView Checkbox Select All in ASP.Net

In the previous article GridView Select Multiple Rows you learnt the multiple row selection in GridView control. Here you will get the C# code sample to select all the gridview rows using single checkbox server control. You can highlight the selected rows with different color and Font state Bold. If you want to use the selection values on different ASP.Net

Editing the Data in a GridView

In addition to deleting a GridView's underlying data, another common need is to allow end users to edit the data displayed in a GridView. With ASP.NET 1.x's DataGrid control, editing the data is certainly possible, but requires creating three event handlers and writing a dozen or so lines of code. With the GridView and ASP.NET 2.0, it is possible to create an editable GridView without writing a single line of code! All of the necessary functionality is encapsulated within the GridView.

The GridView allows editing on a row-by-row basis. An editable GridView contains an additional column with an Edit button in each row. When the end user clicks on an Edit button that row becomes editable, causing the Edit button to change to Update and Cancel buttons and the other columns to become TextBoxes. The end user can then update one or more column values and click Update to save their changes.
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