Click here to Skip to main content
16,004,686 members

Comments by Pandey Vijay Kumar S. (Top 2 by date)

Pandey Vijay Kumar S. 3-Apr-12 1:24am View    
The textboxes generated at run time by the way,
>
>
> Public Sub GrdAPTB_RowCreated(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GrdAPTB.RowCreated
> Try
>
> If (e.Row.RowType = DataControlRowType.DataRow) Then
> Dim dt As DataTable = Session("DTItemAPTB")
>
> Dim grd As GridView = CType(sender, GridView)
> For j As Integer = 4 To dt.Columns.Count - 1
> Dim txt As TextBox = New TextBox
> txt.ID = "txtedit" & j.ToString()
> txt.Enabled = True
> e.Row.Cells(j).Controls.Add(txt)
> Next
> End If
> Catch ex As Exception
> End Try
> End Sub
>
> *****************
>
> Protected Sub GrdAPTB_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GrdAPTB.RowDataBound
> Try
>
> Dim dt As DataTable = Session("DTItemAPTB")
> If (e.Row.RowType = DataControlRowType.DataRow) Then
> If z < dt.Rows.Count Then
> For i As Integer = 4 To dt.Columns.Count - 1
> Dim txtdb As TextBox = New TextBox
> txtdb.ID = "txtdb" + i.ToString()
> txtdb.Enabled = True
> txtdb.Text = dt.Rows(z)(i - 1).ToString()
> e.Row.Cells(i).Controls.Add(txtdb)
> If i = dt.Columns.Count - 1 Then
> txtdb.Attributes.Add("onkeypress", "return validateinput(event)")
> End If
> Next
> z += 1
> End If
>
> End If
>
> Catch ex As Exception
> alt.Show(ex.Message)
> End Try
> End Sub
>
>
> **************And i'm trying to access the textbox values here
>
> Protected Sub btnSort_Click(sender As Object, e As System.EventArgs) Handles btnSort.Click
> Try
> Dim dt As DataTable = Session("DTItemAPTB")
>
> Dim dr As DataRow
> For Each gvr As GridViewRow In GrdAPTB.Rows
> dr = dt.Rows(gvr.RowIndex)
> For f As Integer = 4 To dt.Columns.Count - 2
> If f < dt.Columns.Count - 2 Then
>
> dr(f) = CType(gvr.FindControl("txtedit" + f.ToString()), TextBox).Text
> dt.AcceptChanges()
> Else
> dr(f) = Val(CType(gvr.FindControl("txtedit" + f.ToString()), TextBox).Text)
> dt.AcceptChanges()
> End If
> Next
> Next
> End try
>
> *********
> the value of
> CType(gvr.FindControl("txtedit" + f.ToString()), TextBox).Text
> is showing " "
>
>
> *****************
>
Pandey Vijay Kumar S. 2-Mar-12 5:59am View    
Please send ur way