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 !




Generating gridview in runtime


Posted Date: 18 Jun 2008    Resource Type: Code Snippets    Category: C# Syntax

Posted By: mahua dutta       Member Level: Silver
Rating:     Points: 9




public void QuickSearchproduct123()
{
ds100 = quicksearch.select_product_type();
if (ds100.Tables[0].Rows.Count != 0)
{
for (int k = 0; k <= ds100.Tables[0].Rows.Count - 1; k++)
{
example = Convert.ToString(ds100.Tables[0].Rows[k]["product_type"].ToString());
int z = Convert.ToInt32(ds100.Tables[0].Rows[k]["company_id"].ToString());
string[] me = example.Split(',');
int i;
for (i = 0; i <= me.Length - 1; i++)
{
Label3.Visible = false;
try
{
if (me[i] == DropDownList7.SelectedItem.Text)
{
try
{
quicksearch.get_company_id = z;
ds = quicksearch.companysearch();
if (ds.Tables[0].Rows.Count != 0)
{
Label3.Visible = false;
GridView dg = new GridView();
dg.AllowPaging = true;
dg.PageSize = 50;
dg.Width = 50;
dg.Height = 50;
dg.DataSource = ds;
dg.DataBind();

Panel5.Visible = true;
Panel5.Controls.Add(dg);
flag = 1;
}
else
{
// Page.ClientScript.RegisterStartupScript(this.GetType(), "msg", "");
Panel5.Visible = false;
}
}
catch (Exception ex)
{ }
}
else
{
}
}

catch (Exception ex)
{
// Page.ClientScript.RegisterStartupScript(this.GetType(), "msg", "");
}
}
if (flag==0)
{
//Page.ClientScript.RegisterStartupScript(this.GetType(), "msg", "");

Panel5.Visible = false;
}
PagedDataSource page = new PagedDataSource();
page.AllowPaging = true;
}
}
else
{
// Page.ClientScript.RegisterStartupScript(this.GetType(), "msg", "");
}
if (flag == 0)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "msg", "");

Panel5.Visible = false;
}

}
..................call this method in the button click event..........
here i take a panel and make this false in property........
pageload()
{if (!IsPostBack)
{}
Panel5.Visible = false;

}




Responses


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

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Grideview  .  Generating Grid View  .  DataGridview  .  

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: Show confirm message on row delete of DataGrid
Previous Resource: LINQ - Where Clause
Return to Discussion Resource Index
Post New Resource
Category: C# Syntax


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use