.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 Retrieve the Hidden Cell value in GridView -- Urgent ************

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

Hello all,

In my GridView I have Hidden column contains ID. When User selects the rows and clicks on Delete Button( This is placed top of the Grid) Selected Rows will be deleted.

my delete button code is ...

foreach (GridViewRow dgi in Grid_Inbox.Rows){

CheckBox chkSelected = (CheckBox)dgi.FindControl("chk_Select");

if (chkSelected.Checked == true)


string strID = dgi.Cells[1].Text;

//Delete the Rows



//Binding the Grid



problem is when i am accessing through the code. getting cell value as bla

View Complete Post

More Related Resource Links

How can i add a textbox into a GridView Cell dynamically and how can i retrieve entred data

Hey, i think that the the subject can explain what i need, it's about adding a TextBox control with the code behind into a GridView, and also about how can i retrieve entered data after submitting, im using C#,Thanks.

I need to set the value of a gridview cell during update.

Hi,  I've been reading the posts here and I'm not finding, or maybe just not understanding, the answer I need so here's my problem. I have a small gridview and the update works very well. The issue is I need to have one of the fields set to a value from my code either when the record is open for undating or when the update runs.  Here is my gridview and the datasource info:<asp:GridView ID="GridViewItemLog" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" BackColor="White" BorderColor="#999999" CellPadding="3" DataKeyNames="LogID" DataSourceID="SqlDataSourceItemLogEntries" GridLines="Vertical" onrowdatabound="GridViewItemLog_RowDataBound" onrowupdating="GridViewItemLog_RowUpdating" onrowediting="GridViewItemLog_RowEditing"><AlternatingRowStyle BackColor="Gainsboro" /><Columns><asp:CommandField ButtonType="Image" CancelImageUrl="~/Resources/StopSmall.png" EditImageUrl="~/Resources/EditSmall.png" ShowEditButton="True" UpdateImageUrl="~/Resources/Save.png" /><asp:Boun

How to retrieve all records from GridView and assign to DataSet

 Hi, I dont know why my GridView.DataSource is become nothing when the Page.IsPostBack = true.What i did is bind the dataset to the GridView.DataSource when page load. Then when the button click event is trigger i need to get all the records from GridView. But when i debug and check i found that the GridView.DataSource is become nothing. Can someone tell me how should i get all records from the GridView and assign to dataset. I'm using VB.net to work on. Thanks.

ASP.NET GridView help!! Need to be able to scroll an individual cell up and down.

Hi everyone.  I have an ASP.NET GridView displaying the below grid.  As you can see, the column on the right has a LOT of text and it stretches the column.  I need to be able to set a fixed width for JUST that column (maybe like 200px) and have vertical scroll bars on that cell so the user could scroll down to read the rest of the text, is that possible to do?Here's my markup: <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource2" AutoGenerateColumns="False" AllowPaging="True" AlternatingRowStyle-Wrap="False" CellPadding="4" ForeColor="#333333" GridLines="None"> <RowStyle Height="30px" BackColor="#EFF3FB" /> <Columns> <asp:BoundField DataField="Customer_Name" HeaderText="Customer" SortExpression="Customer" /> <asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status" /> <asp:BoundField DataField="Module" HeaderText

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,

Javascript code to copy specific cell of gridview row

Dears, I need a javascript code to copy the text content of a cell of a row in gridview. I have a button in each row that users click it and the text content a cell of that row should be copied in a textbox out of gridview

Gridview Cell Hightlight with toggling

Hi, I have a dynamically generated Gridview wherein every tablecell within the gridview is assigned a particular class(background color) at run time. Each cell has  a linkbutton and I have a onClientClick event where, I would like to highlight the container cell when the user clicks on the linkbutton.If the user clicks it back, I would it to  get back its original class/background color that it was bound with earlier. I am trying to implement this in Javascript by passing the original className but I am unable to toggle the color back to original.Please help. Here is a snippet of code. I could do it in c# but I would like to implement this in Javascript as it won't  cause postback.Thanks so much!//Linkbutton databinding event private void lb_DataBinding(Object sender, EventArgs e)     { private void lb_DataBinding(Object sender, EventArgs e)    { LinkButton l = (LinkButton)sender; l.OnClientClick = String.Format("doClick({0},{1},'{2}','{3}','{4}','{5}','{6}'); return false;", x, y, className, tbPercentSoldUpfrontSelected.ClientID, tbPercentChangeDemandSelected.ClientID, tc.ClientID, l.ClientID);} function doClick(val1, val2, val3, control1, control2, control3, control4)         {         &nbs

Gridview's cell have changed



   does anyone know if the gridview can tell you if a cell's contents have changed (during an edit) in order to determine if an update should be made against the database?

How Get selected cell values from gridview


How Get particular selected cell value from gridview . my grid so many cell available..

i'm created dynamic row and cell ...

Gridview Cell Merging


Hi All,

I have a grid, where i need to do cell merging till certain columns. It is working and the code is as follows.

Friend Shared Sub GridviewCellMerge(ByRef gridViewControl As GridView, ByVal colStart As Integer, _
                                            ByVal colLast As Integer)
            For rowIndex As Integer = gridViewControl.Rows.Count - 2 To 0 Step -1
                Dim gvRow As GridViewRow = gridViewControl.Rows(rowIndex)
                Dim gvPreviousRow As GridViewRow = gridViewControl.Rows(rowIndex + 1)
                For cellCount As Integer = colStart To colLast
                    If gvRow.Cells(cellCount).Text = gvPreviousRow.Cells(cellCount).Text Then
                        If gvPreviousRow.Cells(cellCount).RowSpan < 2 Then
                            gvRow.Cells(cellCount).RowSpan = 2
                            gvRow.Cells(cellCount).RowSpan = gvPreviousRow.Cells(cellCount).RowSpan + 1
                        End If
                        gvPreviousRow.Cells(cellCount).Visible = False
                    End If
        End Sub

1. a  b  c  d

2. a  b  c  e

3. a  b  f  e

4. a  b  f  e

5. a  b  g 

URGENT: Gridview/formview with entitydatasource

I'm trying to get a Gridview/formview working but when using entitydatasource,
How is it done with the entity framework?  I want the formview to display the data selected in the gridview for edit and I want to insert new data from the formview to the grid.
Any links or help is appreciated. This is urgent!!


Accessing gridview cell values


Hi All,

In my application Iam using GridView, in this there are fields (Quantity, Price, Amount) the user can enter Quantity Field value which is a template field (textbox). Iam calculating Amount(Quantity * Price) using Javascript and assigning to the Amount Column cells as below

Gridviewcell.innerText=Quanity * price.

and when user clicks on the Save button I want to add these details of Gridview to the database.

when I try to access the values of the gridview using below code

For i=0 to GridView.rows.count-1

GridView.Rows(i).Cells(2).toString ( for Example)

Next i

It is not displaying the changed value instead it is displaying the default value before calculating the amount.

Before implementing the Javascript part, I had done this in the code behind and it was working fine... Now I just dont want the page to get load so I used javascript.

Can any one help me out in able to access the value of Gridview cells which are assigned using Javascript.



changing Asp.net Gridview's cell from Label to edit mode in code behined file


 Hi all,

In my asp.net application i'm using gridview to which i'm binding data dynamically by writing a select query in code behined file (all column's are autogenerated) now i want to change gridview cell to edit mode from label to textbox or dropdown on clicking of gridview's cell.How can i achive this in code behined file.

thanks in advance

How to make a cell editable in gridview?


I was trying to create a gridview which should allow to edit a perticular cell on clicking on it. But is not working as expected. Here is my code. Can anyone tell whats the issue with this.

<Window x:Class="Window1"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib"
    Title="Window1" Height="279" Width="672">

        <Style x:Key="TextBoxStyle" TargetType="{x:Type TextBox}" >
            <Setter Property="Background" Value="#00ffffff" />
            <Setter Property="BorderBrush" Value="#00ffffff" />
            <Setter Property="Acce

Can't retrieve value from gridview row in edit mode



I have a grid view. When I click edit, the OnRowCommand fires and the row goes into edit state. Label becomes a TextBox. I then attempt to alter this value in some way and click update. This again fires the OnRowCommand event. The problem is, when I attempt to capture the new value, it instead just shows the original value.

In my grid view I have:


<asp:TemplateField HeaderText="Start Name">





How can a fill a cell in a gridview in a windowsform?


I have a gridview in a windowsform.
There are 4 columns (A, B, C and D).
I column D is a combobox.
How can I fill this combobox at form_load with the following data: --> 

Dyanmically set background color of GridView cell


How can I make the background color of a GridView cell dependent on the boolean value of field?

 <asp:BoundField DataField="L_Enbld" HeaderText="ON" SortExpression="L_Enbld" >
 <ItemStyle BackColor="#CCFFCC" Font-Bold="True" Font-Names="Calibri" />
Want to make red if L_Enbld is false, green if true.
Thank you


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