C# Tutorials and offshore development in India
    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



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Display the selected row information from gridview


Posted Date: 11 Sep 2008    Resource Type: Code Snippets    Category: ASP.NET WebForms

Posted By: gopi       Member Level: Silver
Rating:     Points: 10



IN THIS ARTICLE PROVIDE THE " HOW TO DISPLAY THE SELECTED ROW INFORMATION" FROM THE GRIDVIEW
SO
1st add the one gridview to your aspx page
then set the property AutoGenerateSelectButton="True"

USING the one namespace
using System.Data.SqlClient;

on page_load
---------

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++;
}

Response.Write(s);
}


have a nice day
happy progaramming......




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Selected row  .  Information  .  Gridview  .  Display  .  

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: Creating a database and running script files using customized setup file
Previous Resource: Check Username during registration in asp.net
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET WebForms


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

teleconferencing service

Contact Us    Privacy Policy    Terms Of Use