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

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

get a correct row index after refresh the gridview table

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

hi all,

i am facing a problem to get a correct row index after i filter the data in table, it always keep the history row index in the table  before i filter. i had a search button to filter the data in gridview,

below is my coding:


 <asp:Button ID="btn_reissue" runat="server" Text="Reissue" CommandName="reissue"  CommandArgument='<%# CType(Container, GridViewRow).RowIndex %>' OnClientClick="return window.confirm('Are you sure you want to reissue this record?');" Width="65px" />


    Protected Sub grdview_rowcommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gridView1.RowCommand
        Dim cmd As SqlCommand
        If e.CommandName = "reissue" Then
            If Not pUser Is Nothing Then
                pDbUserCon = New SqlConnection(pDbESS)
                pDbUserTrx = pDbUserCon.BeginTransaction()
                    Dim index As Integer = Convert.ToInt32(e.CommandArgument)
                    Dim row As GridViewRow

View Complete Post

More Related Resource Links

determine the best way to refresh a gridview when textchanged event occurs


Good afternoon.

I have the following gridview inside an updatepanel that makes the bind from a datatable:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <asp:Button ID="ButtonAdd" runat="server" OnClick="ButtonAdd_Click" Text="Novo Artigo" />
                <asp:GridView ID="Dados" runat="server" AutoGenerateColumns="False" 
                    CssClass="Grid" Width="100%" CellPadding="4" ForeColor="#333333" 
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                        <asp:Button ID="AbrirModal" runat="server" Text="->" /> 
                                <asp:PopupControlExtender ID="PopupControlExtender1" runat="server"

Application to Constantly query Table Values and Refresh with most recent value

Hello, I must apologize in advance because I am not sure if this is the correct place for this question. I am looking for ideas on how to build an application that in the most basic sense contains a field with the most current data from a table in a SQL Server database (this would be based off of a datetime timestamp in the table). I am new to this kind of problem and am unsure where to start looking for solution ideas. The table value updates variably and could possibly update every second to every hour. I would like to design an application that would be lightweight to both the server and the user's machine. This would take the place of an unneeded report on my Reporting Services server. Any and all suggestions would be welcome because I am not sure of options I even have on this. Thanks in advance for your time and consideration, Matt

gridview table alignment problem

hi all, i designed a gridiview, within that ItemTemplate i drew an table then tr then some of td's, now the problem is after every row im getting one empty row, what is the problem and how to resolve it. below is my code <ItemTemplate>                                             <table cellspacing="0" cellpadding="0" style="border-right:1px solid Black;" >                                                 <tr  >                                                     <td width="1%" align="center" style="border-right:1px solid Black;">          &n

Repeating table not showing content following a rule refresh

Background info: I have a form where I populate employee info from the GetUserProfileByName ws. From there I populate its manager info from another web service call (seperate data connections).  Once the manager is populated, through rules, I'm populating the first approver. All this is done at form load through rules. The approvers node is defined as follows and is displayed on the form as a repeating table:  participants (group)    approver (repeating group)       ApproverName       ApproverLogin       ApproverEmail Problem: The repeating table is not showing any content even though I'm using an alert to show that I do in fact have one row in there. As a side note, I know the table is working because if the user elects to delegate approval to another user (through the people picker), the table shows these approvers correctly.  Anyone as any clue what I'm doing wrong? Thanks!    

My problem with an gridView, Input string was not in a correct format.

Hello all ! I'am actually encounter problem with an gridView which is composed of five columns, the both first are string type, third is date and the two last are linkbutton to edit or delete rows. On clicking edit button, i catch good event to edit and traitment  work fine but on living function an error occur with this message : error : System.FormatException: Input string was not in a correct format. stackTrace :   [FormatException: Input string was not in a correct format.] System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +7471479 System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +119 System.Web.UI.WebControls.GridView.GetRowIndex(GridViewRow row, String commandArgument) +99 System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +602 System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument) +207 System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175 System.Web.UI.Page.ProcessRequestMain(Boolean inclu

how can i force to use index on table

I have go through execution plan,it shows me a table scan(10%) on a table who has the index column.then also it show table scan so how can i force it to use the indexe column from the table???   Thank's Digambar

Changing table name and Index relation

Hi experts, Does changing the table name in sql require anything with the indexes as well? Do I need to drop and create indices in this case? Regards

Partitoning Table in SQL 2008 - Index

1. How is the index mainitained for a partitioned table?  2. Whether SQL Server has an overhead in maintaining INDEX in a partitioned table compared to a non-partitioned one? 3. If i insert few rows, does it affect the INDEX statistics in all partitions or only the affected partition. I would like to find out more details on how SQL Server manages INDEX on a partitioned table.

hoq to fill gridview dropdownlist from another db table

Hi, I have a gridview which gets its data from a database table now i ghave added a dropdownlist to this gridview but this dropdown should get the data from another table and should set its value automatically with a foreign key from the  gridview i have added the code like below in my rowDatabound but it just loads 1 field and then how should i get the selectedValue according to the gridview id field?? Protected Sub Friends_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)             If e.Row.RowType = DataControlRowType.DataRow Then                 Dim conn As New SqlConnection(HttpRuntime.Cache("con"))                Dim sql As String = "select ID,ListName from FriendList order by ListName asc"                Dim cmd As New SqlCommand(sql, conn)                cmd.CommandType = CommandType.Text                conn.Open()             &

gridview column index

how can i change column index of girdview ,i have to show button at right hand side

Table scan going on apart from having an Index



I have a stored procedure where the performance is bad. The Execution plan shows 5 table scans each of cost 12%. The data is being pulled from the table using the following where clause.

where (datestamp>getdate() - 'sep28 1902 12:00 AM')

I already have an index on Datestamp column but still Table scan is happening. There is no restriction on avoiding index is specified in the query. 

If the index is place inappropriately there would be index scan but here I have table scan.

Could anyone help me in finding out why this is happening.


-Thank you,


Table scan going on apart from having an Index



I have a stored procedure where the performance is bad. The Execution plan shows 5 table scans each of cost 12%. The data is being pulled from the table using the following where clause.

where (datestamp>getdate() - 'sep28 1902 12:00 AM')

I already have an index on Datestamp column but still Table scan is happening. There is no restriction on avoiding index is specified in the query. 

If the index is place inappropriately there would be index scan but here I have table scan.

Could anyone help me in finding out why this is happening.


-Thank you,


change index of dropdown in gridview


 i have got grid view with 4 coloums which contains 2 dropdown list. n i have 2 drop down list out side the gridview .

i want to change the index of the 1st coloum  dropdown list inside the gridview when changing the drop down list  index outside using javascript

similarly the when the 2nd dropdown list(out side ) index change the 2nd coloumn dropdown list in gridview should change..

 In short the outside placed dropdown list should act as master dropdown list.

pull some data from a table twice for same gridview


 Hello all - I have been searching google for a solution to this problem but I'm having difficulty describing it in keywords.

environment:  VWD 2010 Express, VB, SQL Express, .NET 4.0

I have a gridview that currently pulls data from a table called CrossRef which has the ID numbers of tasks that need to go in a certain sequence.  So the gridview looks like:

Task 1       Sequence          Task 2           XRefID

10               BEFORE             22                 4

2                AFTER                6                  5

17              BEFORE              2        

avoid gridview refresh



i designed a gridview, page load event i bind some reocrds to the gridview(the gridview is within Updatepanel only.). after that using JS i have modified the rows data. but one time the page hit row_command event at that time all the modified data by JS was reverted and i can see only the row data which was binded at page_load event. but i want to see the JS data alwayas visible even if its hit server side event,how to do that?

How do i iterate through a table that does not have an index column?


hi friends,

I have the following table variable that i store rows extracted from an xml document;

declare @tbl_ans table ( AnsText nvarchar(max), IsCorr bit)

this cannothave an index column.

assume it has 25 rows, i need insert each row to a table  that has three columns

That Answers table has following structure:

a_idx int,

a_text nvarchar(max),

is_active int,

upt_date datetime

The script should iterate through the @tbl_ans_table table and insert each to the answers table then i should fetch each a_idx in each iteration and insert it to another. But the problem is how itereate through @tbl_ans_table without an index?



row index of gridview on popup extnerder image


hi to all

i have a gridview which contain a textbox an imagebutton which will popup a popup window

if i m using model popup extender i m able to fetch the row index of gridview  through command arguement  in rowcommand event

but as if i m using popup extender i m not able to fetch the row index of gridview its not identifying the command arguement

is there any other way to do so

example of Model Popup extender



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