Tutorials
Resources
Forum
Communities
Interview
Jobs
Projects
Offshore Development
Silverlight Tutorials
|
Mentor
|
Code Converter
|
Articles
|
Code Factory
|
Computer Jokes
|
Members
|
Peer Appraisal
|
IT Companies
|
Bookmarks
|
Revenue Sharing
|
Prizes & Awards
My Profile
Sign In
Register
AdSense Revenue
Active Members
Today
Appukuttan
(94)
Abhi
(72)
Babu Akkandi
(63)
Last 7 Days
Appukuttan
(619)
Babu Akkandi
(470)
divya
(321)
more...
New Feature:
Community Sites
:
Create your own .NET community website and start earning from Google AdSense !
It's Free !
Display row information on separate page
Posted Date: 11 Sep 2008
Resource Type:
Code Snippets
Category:
ASP.NET GridView
Author:
gopi
Member Level:
Silver
Rating:
Points
: 10
This code snippet is used to display the selected row information from the gridview.Below are several steps to be followed.
Step1: Add one gridview to your aspx page
Step2: Set AutoGenerateSelectButton property to "True"
Step3: Use System.Data.SqlClient name space.
Step4: In page_load()event add the following code.
SqlConnection con = new SqlConnection("integrated security=true; database=gopidb; server=localhost");
SqlDataAdapter da = new SqlDataAdapter("select * from emp", con);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
protected void GridView1_SelectedIndexChanged1(object sender, EventArgs e)
{
DataSet ds1 = new DataSet();
int k = GridView1.SelectedIndex;
int m = 0;
string s = "";
while (m < 4)
{
s += " ";
s += ds1.Tables[0].Rows[k][m].ToString();
m++;
}
Session["row"] = s;
Server.Transfer("selrowinfo.aspx");
}
Step5: Add another new aspx page and then drog and drop one Label on the same page.
Step6: Add the following code on this new page_load() event.
page _load()
{
Label1.Text = Session["row"].ToString();
}
Responses
No responses found. Be the first to respond and make money from
revenue sharing program
.
Feedbacks
Popular Tags
What are tags ?
Search Tags
Sign In
Displaying selected row information from the gridview
.
Post Feedback
This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must
Sign In
to post a response.
Next Resource:
Bind a CSV file with Gridview
Previous Resource:
Gridview Paging
Return to Discussion Resource Index
Post New Resource
Category:
ASP.NET GridView
Post resources and
earn money
!
Related Resources
Different types of DataGrid Event
Client side validation [Javascript] on click of Datagrid Update button
Repopulate Grid-Using DropDownList
Editing, Deleting Gridview in VB.net 2.0
Using SqlBulkCopy to Add New Record into GridView
dotNet Slackers
BizTalk Adaptors
Web Design
Contact Us
Privacy Policy
Terms Of Use