Click here to Skip to main content
15,916,842 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Column wise paging in a Gridview Pin
Parwej Ahamad2-Jun-08 6:43
professionalParwej Ahamad2-Jun-08 6:43 
Questioninsert datas from gridview to database using asp.net.+ c# Pin
kushan31-May-08 1:34
kushan31-May-08 1:34 
QuestionHow i can update GridView in web page when i edit or delete or insert a record in database? Pin
Saba0231-May-08 1:26
Saba0231-May-08 1:26 
AnswerRe: How i can update GridView in web page when i edit or delete or insert a record in database? Pin
Christian Graus31-May-08 1:27
protectorChristian Graus31-May-08 1:27 
QuestionHow to develope a webservice which automatically updates its ad(in window project) from a website Pin
K V Sekhar31-May-08 0:40
K V Sekhar31-May-08 0:40 
AnswerRe: How to develope a webservice which automatically updates its ad(in window project) from a website Pin
Christian Graus31-May-08 1:26
protectorChristian Graus31-May-08 1:26 
AnswerCP IGNORE Pin
leckey31-May-08 4:45
leckey31-May-08 4:45 
QuestionDataBinding to DropDownList in GridView Error Pin
Samiullah31-May-08 0:34
Samiullah31-May-08 0:34 
Hi, As my requirement is i want to bind data to the dropdownlist in the gridview control. when iam doing this iam getting an error. "Cannot implicit convert Type 'string' to 'int'", "Only assignment, call, increment, decrement, and new object expressions can be used as a statement",and "Cannot apply indexing with [] to an expression of type 'method group'". Please help me...My code is as follows..

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
GridView1.DataSource = GetDataSet().Tables[0];
GridView1.DataBind();
}
private DataSet GetDataSet()
{
string connectionString = "user id=sa;password=victory;database=Northwind;server=INDUS-SERVER";
string query = "SELECT p.CategoryID, p.ProductID, p.ProductName, c.CategoryID, c.CategoryName from Products p,Categories c where p.CategoryID=c.CategoryID and c.CategoryID<2";
SqlConnection newConnection = new SqlConnection(connectionString);
SqlDataAdapter adapter = new SqlDataAdapter(query, newConnection);
DataSet ds = new DataSet();
adapter.Fill(ds);
return ds;
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
DataTable myDataTable = new DataTable();
DataColumn productIDColumn = new DataColumn("ProductID");
DataColumn productNameColumn = new DataColumn("ProductName");
myDataTable.Columns.Add(productIDColumn);
myDataTable.Columns.Add(productNameColumn);
DataSet ds = new DataSet();
ds = GetDataSet();
int categoryID = 0;
string exp = string.Empty;
if (e.Row.RowType == DataControlRowType.DataRow)
{
categoryID = Int32.Parse(e.Row.Cells[0].Text);
exp = "CategoryID=" + categoryID;
DropDownList ddl = (DropDownList)e.Row.FindControl("DropDownList1");
DataRow[] rows = ds.Tables[0].Select(exp);
foreach(DataRow roe in rows)
{
DataRow newRow = myDataTable.NewRow();
newRow["ProductID"] = rows["ProductID"];
newRow["ProductName"] = rows["ProductName"];
myDataTable.Rows.Add[newRow];
}
ddl.DataSource = myDataTable;
ddl.DataValueField = "ProductName";
ddl.DataValueField = "ProductID";
ddl.DataBind();
}
}
}
AnswerRe: DataBinding to DropDownList in GridView Error Pin
Parwej Ahamad31-May-08 1:28
professionalParwej Ahamad31-May-08 1:28 
GeneralRe: DataBinding to DropDownList in GridView Error Pin
Samiullah31-May-08 2:08
Samiullah31-May-08 2:08 
GeneralRe: DataBinding to DropDownList in GridView Error Pin
Parwej Ahamad31-May-08 3:53
professionalParwej Ahamad31-May-08 3:53 
GeneralRe: DataBinding to DropDownList in GridView Error Pin
Samiullah3-Jun-08 0:32
Samiullah3-Jun-08 0:32 
GeneralRe: DataBinding to DropDownList in GridView Error Pin
Samiullah3-Jun-08 1:42
Samiullah3-Jun-08 1:42 
GeneralRe: DataBinding to DropDownList in GridView Error Pin
Parwej Ahamad3-Jun-08 7:16
professionalParwej Ahamad3-Jun-08 7:16 
QuestionRegisterStartupScript is user control Pin
rotsey31-May-08 0:28
rotsey31-May-08 0:28 
AnswerRe: RegisterStartupScript is user control Pin
Parwej Ahamad31-May-08 1:26
professionalParwej Ahamad31-May-08 1:26 
GeneralRe: RegisterStartupScript is user control Pin
rotsey31-May-08 3:20
rotsey31-May-08 3:20 
Questionsetting key value pair in webconfig Pin
Mogaambo30-May-08 23:54
Mogaambo30-May-08 23:54 
AnswerRe: setting key value pair in webconfig Pin
MHASSANF31-May-08 0:21
MHASSANF31-May-08 0:21 
GeneralRe: setting key value pair in webconfig Pin
Mogaambo31-May-08 0:24
Mogaambo31-May-08 0:24 
GeneralRe: setting key value pair in webconfig Pin
MHASSANF31-May-08 1:24
MHASSANF31-May-08 1:24 
QuestionQuestion Pin
nithydurai30-May-08 20:43
nithydurai30-May-08 20:43 
AnswerRe: Question Pin
Parwej Ahamad30-May-08 22:48
professionalParwej Ahamad30-May-08 22:48 
GeneralRe: Question Pin
nithydurai30-May-08 22:53
nithydurai30-May-08 22:53 
GeneralRe: Question Pin
Parwej Ahamad30-May-08 23:06
professionalParwej Ahamad30-May-08 23:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.