|
See - when you cross posted to the C# forum, I assumed you meant a winforms grid. Is this post in the wrong forum, or was the other one ? Either way, you'll find CP articles that do what you want. Adding a check box to an ASP.NET grid view is beyond trivial, you just define the column accordingly.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
Hello Everybody
I have a table name tempOrderDetails in order.aspx where i keept order details. Also have Button called btnSubmitOrder.
When you clicked SubmitOrder then all data will add into SQL SERVER, if you have any example or guide line please tell me, it will be really helpful
Thanks in advance
Sarfarj Ahmed
|
|
|
|
|
To store data in a database is about as widely documented on the web as anything could be. It's also the sort of task where reading an online article makes more sense than working off the quick notes someone will enter for a forum reply. Do you have a data layer already ? Is the database set up already ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
What I have done so far is.........
I have created a table into SQL SERVER called tempOrderDetails where I can add order data and at the same time I retrived those data to show it to shopping cart but i think its not good idea because every single time i am adding data into server.
Also I can create session data table in .aspx page and show it to shopping cart but I cant add all data into SQL SERVER
So I need to know how can I insert data into SQL SERVER from SESSION data table.
Thanks in advance
Sarfarj Ahmed
|
|
|
|
|
|
i am getting following error when i created a user control and included it in my webpage
I have made following entry
<controls>
<add tagprefix="aspValidators" namespace="Validators" assembly="Validators">
Error 36 The type 'Validators.MultiValidator' exists in both 'e:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\cars\3c3cdf90\be9da\App_Code.yvwpiphu.dll' and 'e:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\cars\3c3cdf90\be9da\assembly\dl3\1817c530\409acd6b_22c3c801\Validators.DLL' E:\cars\Default3.aspx 17
Error 37 The type 'Validators.MultiValidator' exists in both 'e:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\cars\3c3cdf90\be9da\App_Code.yvwpiphu.dll' and 'e:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\cars\3c3cdf90\be9da\assembly\dl3\1817c530\409acd6b_22c3c801\Validators.DLL' e:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\cars\3c3cdf90\be9da\App_Web_9xfr2bx9.0.cs 279
modified on Saturday, May 31, 2008 10:08 AM
|
|
|
|
|
Looks like you're using the same class name in two dlls. If this is not the case, do a rebuild all and see what happens.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Normally we can page only Row wise in Grid view (ie if i select 5 in a dropdownlist only first 5 rows will be displayed in Grid and cliking Next page i'll get remaining 5 and so on).... but i want this method to done Column wise....
if i select 5 in a dropdown list i must get 5 columns with all rows.
can someone help me...
|
|
|
|
|
Did you try :-
GridView1.Columns[Col no..(1,2,..)].Visible=false;
on Page Load event
Parwej Ahamad
R & D with IIS 5.0/6.0
|
|
|
|
|
sorry let me explain my scenrio, I have 2 type of display in dropdown as Horizontal and vertical. if select horizontal it is normal gridview but on selecting vertical, i'm converting Rows into column to get vertical display in Gridview, the datasource is dynamic dataset. so in this mode, i already tried the paging as like ur idea by assuming the Dropdown(page dropdown selecting 5 0r 10 etc...)value as i in a forloop, but i get an error..
The code i wrote was
for (i=0;i<=int.Parse(drppagelist.SelectedValue.ToString());i++)
{
GridView1.Column[i].Visible=True;
}
but error comes as value cannot be 0 or less than index range...
|
|
|
|
|
I understand your problem. Please follow up my previous post.
Dear, Right now you are facing a little bit logical issues like index of range, this is not a major problem just try it you will resolve it.
Parwej Ahamad
R & D with IIS 5.0/6.0
|
|
|
|
|
In my from i use grid view .In that i add rows and values dynamically on button click.when i click the submit button all the row values must be insert in to database how can i do that.In grid i didnt use any template.I just add values in that.how can i find each row vaues and save to database.
|
|
|
|
|
Hi all,
I have a gridview that when i select a row of gridview a detailview comes that i can edit or delete or insert a record in database.
but this changes not be shown in my gridview that time.
i should again run my program that these changes be shown in my gridview.
How i can update GridView in web page when i edit or delete or insert a record in database with detailview without re run?
Thank you,
Hoda
|
|
|
|
|
You should bind your data grid to it's data source in prerender, not in page load. Then, it will occur after any event handlers, and you should see the results.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi all...
I think my subject line not dat much clear...
Here is My Requirement:
*I hav windows project ..it displays ads in the masterform.. and also
*I hav webproject in dat user is going to add their adds(i mean de can register their ads in dis webproject)
Actually Client uses the Windows project.. when client is connected to internet and opens our website(our webproject) den we have to upload our ads which r registered in our webproject into ClientSystem(Window project) in place of ads(In masterform we r providing place for Displaying ads..AdRotator )..
How can i achieve this.. how can i solve dis by WebServices/WinodwsServices...
Plz..Help me in dis issue...I need ur suggestions....
Thanks in Advance.
Thanks&Regards,
kvsekhar
|
|
|
|
|
Please don't be doing de cross post in de different forums. Dat be annoying.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
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();
}
}
}
|
|
|
|
|
Can you tell me on which line your getting the Error ?
Parwej Ahamad
R & D with IIS 5.0/6.0
|
|
|
|
|
Iam getting the error with the following lines...
DataRow newRow = myDataTable.NewRow();
newRow["ProductID"] = rows["ProductID"];
newRow["ProductName"] = rows["ProductName"];
myDataTable.Rows.Add[newRow];
|
|
|
|
|
I noticed that the Column "ProductID" (DataColumn productIDColumn = new DataColumn("ProductID") did not specify the Data type.
I think your data base returning ProductID as int type.
So you can resolve this prob lem in two way
(1) newRow["ProductID"] = rows["ProductID"].ToString();
OR
(2)Also specify the Data type as int, When you are creating the column
DataColumn productIDColumn = new DataColumn("ProductID")
Parwej Ahamad
R & D with IIS 5.0/6.0
|
|
|
|
|
Still iam getting the same error even if i do the things whatever you said..please any further suggestions..
|
|
|
|
|
Even i tried your solution then also iam getting the same error..Please any further suggestions...
|
|
|
|
|
Can you post here modified code which i have suggested to you ?
Mark as bold where you are still getting the problem and also post error messages.
Parwej Ahamad
R & D with IIS 5.0/6.0
|
|
|
|