|
Hi Guyz Good Morning,
I want to know the following for loop is corrcet or not,
Everything going on well in that for loop...,
But i feel for each data table the loop is going on more than once...,
Its possible to do any modification in that...,
Plz give me ur suggestion abt this:
for (int i = 0; i < DS.Tables.Count - 1; i++)
{
System.Web.UI.WebControls.DataGrid grid = new System.Web.UI.WebControls.DataGrid();
grid.HeaderStyle.Font.Bold = true;
foreach (DataRow dr1 in DS.Tables[i].Rows)
{
foreach (DataRow dr2 in DS.Tables[i + 1].Rows)
{
if (dr1["MID"].ToString() == dr2["MID"].ToString())
{
if (!Directory.Exists(_path + "\\" + dr1["EID"].ToString() + @"\"))
{
Directory.CreateDirectory(_path + "\\" + dr1["EID"].ToString() + @"\");
string _XLSPATH = _path + "\\" + dr1["EID"].ToString() + "\\" + dr1["Name Of Employee"].ToString() + ".xls";
using (StreamWriter sw = new StreamWriter(_XLSPATH))
{
using (HtmlTextWriter hw = new HtmlTextWriter(sw))
{
grid.DataSource = DS.Tables[i];
grid.DataBind();
grid.RenderControl(hw);
}
}
}
else
{
string _XLSPATH = _path + "\\" + dr2["EID"].ToString() + "\\" + dr2["Name Of Employee"].ToString() + ".xls";
using (StreamWriter sw = new StreamWriter(_XLSPATH))
{
using (HtmlTextWriter hw = new HtmlTextWriter(sw))
{
grid.DataSource = DS.Tables[i + 1];
grid.DataBind();
grid.RenderControl(hw);
}
}
}
}
else
{
if (!Directory.Exists(_path + "\\" + dr2["EID"].ToString() + @"\"))
{
Directory.CreateDirectory(_path + "\\" + dr2["EID"].ToString() + @"\");
string _XLSPATH = _path + "\\" + dr2["EID"].ToString() + "\\" + dr2["Name Of Employee"].ToString() + ".xls";
using (StreamWriter sw = new StreamWriter(_XLSPATH))
{
using (HtmlTextWriter hw = new HtmlTextWriter(sw))
{
grid.DataSource = DS.Tables[i + 1];
grid.DataBind();
grid.RenderControl(hw);
}
}
}
else
{
string _XLSPATH = _path + "\\" + dr1["EID"].ToString() + "\\" + dr1["Name Of Employee"].ToString() + ".xls";
using (StreamWriter sw = new StreamWriter(_XLSPATH))
{
using (HtmlTextWriter hw = new HtmlTextWriter(sw))
{
grid.DataSource = DS.Tables[i];
grid.DataBind();
grid.RenderControl(hw);
}
}
}
}
}
}
}
Thanks & Regards,
NeW OnE,
please don't forget to vote on the post
|
|
|
|
|
Hi,
How to color some cells of table? I mean that i have for suppose 48 cells in a single row how i color some cells based upon condition ?
Regards
Thanks in advance
|
|
|
|
|
Is that ASP.NET table or HTML table?
You can iterate through the cells in ASP.NET table.
HTML table - Tricky...
|
|
|
|
|
Thanks for response
actually iam using asp.net table kindly write few lines of code that how i do that .
i want to color few cells for example 4 to 8 i want to color cells othere reamins same .
tahnks
|
|
|
|
|
For Each row As TableRow In MyTable.Rows
For I As Integer = 4 To 8
' Do some color formatting
Next
Next
|
|
|
|
|
Dear
I using Windows Vista with IIS7.0, but i can't run ASP and ASP.NET,
Please help me, how can i do?
Socheat
|
|
|
|
|
Have you installed IIS 7 fully or just the default?
By default IIS 7 installs without the support for ASP, ASP.NET, etc. You can turn it on from Control Panel. There is an option called "Turn off or on Windows programs". As far as I used it does not ask for OS CD/DVD.
Let me know if you still have the problem.
|
|
|
|
|
In IIS7, I check all in sub item, but in sub item I don't see where to enabled ASP or ASP.NET at all
Socheat
|
|
|
|
|
Really?
What Type of Vista you are having?
|
|
|
|
|
I found ASP and ASP.NET already, but after I installed it, I still can't use it, the error message as Internal Server Error
1. Disabled Client Impersonation
2. Disable the error
3. Move this application to an application pool using the Classic.Net(PREFERED).
so, how can I fix it?
Socheat
|
|
|
|
|
Socheat.Net wrote: but after I installed it, I still can't use it, the error message as Internal Server Error
Since IE is not showing the error exactly, its difficult to predict. But you can still get the exact error message by turn off the "Show friendly error messages" in Internet Options of the Internet Explorer. This idea may not help sometimes. Just give a try...
|
|
|
|
|
hi, I hosted this website on the server and it's working fine. Now I need to add a virtual directory for another asp.net webapplication and I should access it using "www.mysite.com/forum" but the problem is that the site first goes to the main hosted website and fails to jump to the virtual directory.
I created a folder in the main webiste called forum and in the properties of this folder, I redirect to the virtual directory of the forum.. but he first goes to the main website since its the default on the server and he can't seem to know how to reach the forum virtual directory.
can someone help?
|
|
|
|
|
If you create a new website at that location, I don't see why it would not work.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hi, I have a domain and I created two web applications, one of them is working fine. The admin actually put the applications folder on the root of the default website of the iis (Default web site >> app_code....and so on). But now I need to create a virtual directory for the second application. I created it but I can't access it since the default website first accesses the web.config file of the application so this causes an error and I can't reach the default web page of the second application through its virtual directory. How can I browse the second application on the server?
from what I understood, if I remove the application folders from the root and then created a virtual directory for the first application, the second application is accessed successfully..but the problem is that if I accessed the application from the virtual directory it'll be like (www.mysite.com/System/login.aspx) and I don't want it like that..I want it to be like www.mysite.com, he should automatically redirect to www.mysite.com/System/login.aspx...
I don't know if I made this clear, but I really don't get how this iis works and I need the two applications to work..can someone help?
|
|
|
|
|
Please don't ask twice.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hi Everyone
I need to call two methods, (one written in javascript defined in the header part of an aspx page and the second written in c# in aspx.cs file of the same aspx page) in the button_click action of a button in the aspx page. The first method is about to show the user a please wat page, and the second method processes the user input.
And I can not put the first method from within the second one, because of some problems.
Please help me.
|
|
|
|
|
I see you crossposted this. Please do not do that in future.
It seems you have major issues. Read up on what ASP.NET is, and how it works. Then, consider that if your page is doing a postback, it won't show anything. AJAX is what you need here.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
I need to convert an application from WinForm to WebForm.
Anyone had an experience with doing something like that?
tnx in advance
|
|
|
|
|
It's called a rewrite, I am afraid.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
|
Anybody uses Gaia ajax widgets, http://ajaxwidgets.com/[^]? And what is your experience?
Seems like a good alternative for MS asp.net ajax.
My reason for not going for MS asp.net Ajax : heavy and confusing client script library, so bad performance, and hard to extend.
Thanks,
Gidon
|
|
|
|
|
hi
I am writting the following code to send email:
Dim smtpC As New System.Net.Mail.SmtpClient("smtp.gmail.com", 587)
Dim message As New System.Net.Mail.MailMessage("gauravvmahhajan@gmail.com", "gauravvmahhajan@gmail.com", "gopunjabi.com", "hi")
smtpC.Credentials = New System.Net.NetworkCredential("gauravvmahhajan@gmail.com", "mypassword")
smtpC.UseDefaultCredentials = False
smtpC.EnableSsl = True
smtpC.Send(message)
But it gives error: SMTP Server required secure connection ........
Where I am doing wrong. Please help.
|
|
|
|
|
Mahajan,
You should look into the help provided in Google to setup Gmail Account with an Email Client. I believe the SMTP port number for SSL is different than the default (25). Check it and try to use that port number while sending email through gmail. But I am not sure where you could send emails through Google's SMTP server.
|
|
|
|
|
GMAIL SMTP Server requires an authentication in the form of username and password.
The reason, it is giving you this error message is because you have set UseDefaultCredentials to false.
Just set this to true, and it should work like a charm.
Best Regards,
Sam Xavier
www.componentone.com
|
|
|
|
|
Hi,
I have simple formview that adds data to a database.
I need to add the current date there too, as a string.
inside the <insertitemtemplate> I have a textbox for that date string:
<asp:label id="lblDate" text="Date:" associatedcontrolid="txtDate" runat="server" xmlns:asp="#unknown" /> <br />
<asp:textbox text="<%# Bind("msg_date") %>;" width="220" id="txtDate" runat="server" cssclass="contact_formField" xmlns:asp="#unknown" />
in my onLoad subroutine I have:
Dim msg_date As String
Dim dtNow As DateTime = DateTime.Now
msg_date = dtNow.Date
The question is - how do I make the textbox have the value of msg_date form the onload sub?
(I am new to .net programming, so I apologize if this is total nonsense...)
|
|
|
|