C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

For Arathi.....also for other members


Posted Date: 04 Oct 2008      Posted By: cp      Member Level: Gold     Points: 1   Responses: 1



thank for reply

act i want to refresh the gridview of page1 from page2 in asp.net how can i that..
as i had made method in page 1 to refreshgrid so i had to call that method of page1 from page2 is it possible ? ny other option is there....for that.


with ref off
http://www.dotnetspider.com/forum/174395-calling-method-asp-net-c-net.aspx





Responses

Author: Arti     04 Oct 2008Member Level: SilverRating: 4 out of 54 out of 54 out of 54 out of 5     Points: 6

you can define method by passing gridname and bind it in the method itsef & can call from 2 pages.

public static void bingGridView(System.Web.UI.WebControls.GridView grdVw, string sql)
{
string ClassCon = ClassConnection.GetConnectionString();
using (SqlConnection con = new SqlConnection(ClassCon))
{
con.Open();
SqlCommand cmd = new SqlCommand(sql, con);
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
da.Fill(dt);
if (dt.Rows.Count > 0)
{
grdVw.DataSource = dt;
grdVw.DataBind();
}
}
}



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : sorting in gridview in every pageindex in vb.net
Previous : variables in c#
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use