16,004,686 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
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