|
Thanks.
but this query is not accept white space character
|
|
|
|
|
|
Hi all,
How to get the Gridview data (after binding the gridview) into DataTable ?
I tried in the following way. But its giving Exception Unable Convert 'System.Web.UI.WebControls.GridViewRowCollection' to 'System.Data.DataRow'
DataTable dt= new DataTable();
foreach(DataRow drow in Gridview1.Rows)
{
dt.Rows.Add(drow);
}
Please suggest me how to do that.
Thanks in advance.
modified on Wednesday, October 29, 2008 2:32 AM
|
|
|
|
|
Try this:
foreach(GridViewRow drow in GridView1.Rows)
{
dt.Rows.Add(drow);
}
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Thanks for your suggestion.
I will try that.
|
|
|
|
|
Hello Meeram395,
I tried. But i got exception
System.ArgumentException: Input array is longer than the number of columns in this table.
foreach(GridViewRow drow in GridView1.Rows)
{
dt.Rows.Add(drow); //Here i got the above exception
}
|
|
|
|
|
Hello meeram395,
I solved the that exception.
But I am getting empty datarows. DataItem : null
My logic:
BindGridview();
DataTable dt = new DataTable();
dt.Columns.Add();
foreach (GridViewRow dr in GvReport.Rows)
{
dt.Rows.Add(dr); // I am getting the row count as 10. But DataItem is null
}
|
|
|
|
|
I have tried as below and getting the results successfully:
DataTable dt = new DataTable();
dt.Columns.Add();
dt.Columns[0].ColumnName = "User Name";
dt.Columns.Add();
dt.Columns[1].ColumnName = "User Email";
foreach (GridViewRow row in SearchGrid.Rows)
{
DataRow dr = dt.NewRow();
dr["User Name"] = row.Cells[1].Text;
dr["User Email"] = row.Cells[2].Text;
dt.Rows.Add(dr);
}
Hope this helps.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Try this
DataTable workTable= new DataTable();
DataRow workRow = workTable.NewRow();
foreach(DataRow workRow in Gridview1.Rows)
{
workRow["Fields"] = //your gridview rows
dt.Rows.Add(workRow);
}
|
|
|
|
|
Good Afternoon
My Service Killer was designed to kill certain Services and the main Service was "w3wp.exe" , Before the Implementation of the Serice my users Started to loose sessions , there was some settings that have been adjusted in the Recycling on the IIS, and now the "w3wp.exe" gets killed every 10 min, and am not sure if this has to do with the Sessions that are lost.
Need advice
Thank you
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
You are a retard. You write an app that kills a process that is part of IIS, then you're surprised that people lose their sessions ?
Christian Graus
Driven to the arms of OSX by Vista.
"Iam doing the browsing center project in vb.net using c# coding" - this is why I don't answer questions much anymore. Oh, and Microsoft doesn't want me to.
|
|
|
|
|
Thanks for your Comment.
Noted.
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Well said!
Lloyd J. Atkinson
"Logic will get you from A to B, but imagination will take you everywhere" - ALbert Einstein
I look at Microsoft, and turn to my poster on the wall saying: "Bang head here in case of stress".
|
|
|
|
|
Hi, when i am exporting gridview data to excel file, i am facing following error.. can any one give idea..why it so like this?
"Control 'GVExcel' of type 'GridView' must be placed inside a form tag with runat=server."
My code is as follows
mypage.aspx
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GVExcel" runat="server">
</asp:GridView>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /></div>
</form>
</body>
Mypage.aspx.cs
string connstr = "Data Source=ORG33;Initial Catalog=MYDatabase;User ID=sa;Password=miller";
SqlConnection sqlcon = new SqlConnection(connstr);
sqlcon.Open();
string cmdcnt = "Select top 10 * from ORG_TBL_INDSEEDFirst";
SqlDataAdapter sqlda = new SqlDataAdapter(cmdcnt, sqlcon);
sqlda.Fill(ds);
dt = ds.Tables[0];
GVExcel.DataSource = dt;
GVExcel.DataBind();
StringWriter stringWrite = new StringWriter();
HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
GVExcel.RenderControl(htmlWrite); ---Getting Error here
sqlcon.Close();
G. Satish
|
|
|
|
|
Hi All,
I am unsing a HtmlImage in my code and on the click of this image I want to call the key combination "Cltr + Alt + 6". How can I call this key combination using java script.
Plz help me.
Thanks In Advance
Alok...
|
|
|
|
|
I'm facing a problem in blob object in crystal report. What i need is to export a crystal report to PDF format having a blob object(ASP.net Code)
This is the code i'm using.
Dim mstExport As New System.IO.MemoryStream
Response.ClearContent()
Response.ClearHeaders()
If Me.optExcel.Checked Then
mstExport = crReport.ExportToStream(ExportFormatType.WordForWindows)
Response.ContentType = "application/vnd.ms-word"
Else
mstExport = crReport.ExportToStream(ExportFormatType.PortableDocFormat)
Response.ContentType = "Application/pdf"
End If
crReport.Close()
Response.Buffer = "true"
Response.BinaryWrite(mstExport.ToArray())
Response.End()
But when i export this i get an error saying "error detected by dll"
If that image is not there it works fine
(i'm creating an xml schema for data retrieval)
Pls help me. Its very urgent
modified on Wednesday, October 29, 2008 3:47 AM
|
|
|
|
|
Does anybody know the links for top asp.net ebooks download?
|
|
|
|
|
Buy paper books. Or buy ebooks. But, downloading them is stealing. Anything that is remotely current will not legally be free, how could it ?
Christian Graus
Driven to the arms of OSX by Vista.
"Iam doing the browsing center project in vb.net using c# coding" - this is why I don't answer questions much anymore. Oh, and Microsoft doesn't want me to.
|
|
|
|
|
"downloading them is stealing" - This is unfair. You can download a book after paying for it.
|
|
|
|
|
You think he's bought the book and is now trawling the web for download links ?
Christian Graus
Driven to the arms of OSX by Vista.
"Iam doing the browsing center project in vb.net using c# coding" - this is why I don't answer questions much anymore. Oh, and Microsoft doesn't want me to.
|
|
|
|
|
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
You are a scumbag and a thief. You're also showing the MVP logo, which means you're either Microsoft MVP or you're breaking their rules, too. I have forwarded your details on to Microsoft, who will at a minimum make sure that your website is pulled down. Have a nice day.
Christian Graus
Driven to the arms of OSX by Vista.
"Iam doing the browsing center project in vb.net using c# coding" - this is why I don't answer questions much anymore. Oh, and Microsoft doesn't want me to.
|
|
|
|
|
Am Sorry Colin ,
As you can see , i have removed the Downloads. I promise it will not happen again.
Thank you
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
OK, well, it seems from your message that you knew all along it was stealing. I guess it's up to Microsoft if they do anything further, I merely reported you to them.
Christian Graus
Driven to the arms of OSX by Vista.
"Iam doing the browsing center project in vb.net using c# coding" - this is why I don't answer questions much anymore. Oh, and Microsoft doesn't want me to.
|
|
|
|