|
There are a couple of things that you need to check:
+ Successfully get data from DB?
+ Propertly assign this web page to the image control in the datagrid?
...
Also, you can find the sample code using the search functionality of the site or check out this girl[^].
|
|
|
|
|
Hi.. I have a question about passing data.
My problem is i have a page which contain few textboxes, buttons and datagrid. My page actually is like an invoice form.
My question is how can i pass this page whole data to another page for printing purposes? Another question is can we perform printing process in asp.net?
anyone can help me? Thanks..
Best Regards,
Pei Sun
|
|
|
|
|
You can use session variables for passing the data from one page to another.
To print a page use the JavaScript function - window.print();
Thomas
|
|
|
|
|
hi..
what you mean is use session for every variable and then pass to another page? Or got any idea pass the whole page directly to another page?
Best Regards,
Pei Sun
|
|
|
|
|
Why are you using two separate page for that. If it is possible then use it in same page, you can use panels for that purpose. And to put the data in session what you can do is to create an array object and then put it in session.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Thanks... but can you show me some sample how to create an array object and put it in session?
Best Regards,
Pei Sun
|
|
|
|
|
creating a string array is as simple as this:
string[] str = new string[2];<br />
str[0] = "apurva";<br />
str[1] = "kaushal";<br />
<br />
<br />
for(int count=0; count<str.Length; count++)<br />
{<br />
Response.Write(str[count].ToString());<br />
}
Also if you want to have a key value pair then you can use hashtable for that purpose.
Best Regards,
Apurva Kaushal
|
|
|
|
|
OK... Thanks ..
Best Regards,
Pei Sun
|
|
|
|
|
always welcome...
Best Regards,
Apurva Kaushal
|
|
|
|
|
You can post the form to a second page. Use a regular html form instead of a server form, e.g. don't put runat="server" in the form tag. Specify the URL of the second page in the action property of the form.
Use Request.Form["FieldName"] to retrieve each value in the second page.
You can do the printing in ASP.NET, if you wish to use a printer that is connected to the server. If you want to use a printer connected to the client, you have to do the printing from the browser.
---
b { font-weight: normal; }<
|
|
|
|
|
We have a web application which is written for US audience. Some of the application logic uses DateTime.Now, DateTime.Today, etc for things like scheduling items to be posted. For example the photo on the front page can be scheduled to change on a specific date. However our network engineer changed the time zone settings on all the web servers to GMT. Now that photo I mentioned changes over anywhere from 8 - 5 hours early (depending on the time zone of the user). Our offices our pacific time (GMT -8) so I get complaints from staff when scheduled events occur early.
The reason our network engineer changed the time zone was in preparation for growing to multiple locations (pacific coast data center, east coast data center) and "standardization".
The only solution I can come to is to write a TimeZone library that returns dates and times based on values in the web.config or machine.config file.
Can someone give me some perspective? I need to either come up with a workable solution or a good reason why we shouldn't be using GMT.
|
|
|
|
|
Could make your own version of DateTime that does all the adding and subtracting of 8 hours and use it in place of DateTime. Just inherit from System.DateTime and override where needed.
|
|
|
|
|
Sounds a lot like what I was thinking I'd have to do. Although I don't know why I didn't think of actually inheriting from DateTime. That's probably the easiest to implement.
Thanks
|
|
|
|
|
Now I know why I didn't think of inheritance - DateTime is a struct and you can't inherit from a struct:
from msdn (http://msdn2.microsoft.com/en-us/library/ms173231.aspx[^]) :
"struct
A compound data type that is typically used to contain a few variables that have some logical relationship. Structs can also contain methods and events. Structs do not support inheritance but they do support interfaces. A struct is a value type, while a class is a reference type."
So I'll need a utility or wrapper.
|
|
|
|
|
Arg, I didn't even think about that.
Yeah, you'll have to make a helper class to do that.
|
|
|
|
|
Hi All
Sorry for reposting but it is urgent to me
I am trying to write data in to XML file it is working in local but not in Server
How can i give permission to file to write data
Plz give me an idea
It is giving this error
"Access to the path "D:\inetpub\ftproot\dsolusys.com\applicant.xml" is denied"
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
|
|
|
|
|
First off does the account running ASP.Net have read/write permissions to that folder? And do you know what account is running ASP.Net? It might be ASPNET, or it might be the other one used on servers... that I can't remember off the top of my head. Its called something to do with Network Services. It's the one that runs those sorts of things.
|
|
|
|
|
HI all
I am trying to insert data into XML by programetically
It is working fine in local system
But when i upload to server it is giving this error
"Access to the path "D:\inetpub\ftproot\dsolusys.com\Data.xml" is denied."
Why it is giving like this
Any idea ?
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
|
|
|
|
|
Security, security, security. The user account under which the ASP.NET process runs on the server would need permission to access that path.
Here's a link[^] that may be useful.
|
|
|
|
|
HI
Thx for reply
I tryed THE CODE
Still it is giving the SAME error
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
|
|
|
|
|
Hi
First of all put your XML file under the virtual directory for example you have a virtual directory maped to a specific folder named "Test"
Then put the XML file under "Test" directory
and instead of giving the path like D:/data/....
give path=Server.MapPath("xmlFileName.xml")
it must work!!!
------------
Boss said, develop in J2EE or better, so done in .NET
------------
|
|
|
|
|
Hi
THX
I got it
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
|
|
|
|
|
Below code is generating multiple files from the file that the user has uploaded and put the outputs ( multiple text files) to a single file. I am using the NET Zip Library. but, when I run this code, I am getting "size was 1452, but I expected 128028" error on zipos.PutNextEntry(zipentry);
Can you help me to figure this out?
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
try
{
FileUpload1.SaveAs("C:\\ERAFile\\" +
FileUpload1.FileName);
Label1.Text = "File name: " +
FileUpload1.PostedFile.FileName + " " +
FileUpload1.PostedFile.ContentLength + " kb " +
"Content type: " +
FileUpload1.PostedFile.ContentType;
}
catch (Exception ex)
{
Label1.Text = "ERROR: " + ex.Message.ToString();
}
else
{
Label1.Text = "You have not specified a file.";
}
////Find the path/name of the file tha you just uploaded in the server
string filename = "C:\\ERAFile\\" + FileUpload1.FileName;
// string filename = TextBox1.Text;
StreamReader sr = new StreamReader(@filename);
string curDate = DateTime.Now.ToString("yyyyMMddHHmmss");
string strText = sr.ReadToEnd();
sr.Close();
///Generate outputs
ArrayList providers = new ArrayList();
int newPos = strText.IndexOf("~GS");
int curPos = newPos;
string header = strText.Substring(0, newPos);
string footer = "";
while (newPos > 0)
{
newPos = strText.IndexOf("~GS", curPos + 1);
if (newPos > 0)
{
providers.Add(strText.Substring(curPos, newPos - curPos));
}
else
{
int footerPos = strText.IndexOf("~IEA", curPos);
providers.Add(strText.Substring(curPos, footerPos - curPos));
footer = strText.Substring(footerPos);
}
curPos = newPos;
}
string[] arrFooter = footer.Split('*');
string newFooter = arrFooter[0] + "*1*" + arrFooter[2];
int fileCount = 0;
StringBuilder FileList = new StringBuilder();
FileList.Append("The total number of files processed : " + providers.Count + "\r\n");
string filename2 = FileUpload1.FileName.Substring(0, FileUpload1.FileName.Length - 4);
Crc32 crc = new Crc32();
ZipOutputStream zipos = new ZipOutputStream(File.Create(@"C:\ERAFile\"+ filename2 +".zip"));
foreach (string provider in providers)
{
string filename1 = FileUpload1.FileName.Substring(0, FileUpload1.FileName.Length - 4);
fileCount++;
StringBuilder outFile = new StringBuilder();
outFile.Append(header + provider + newFooter);
string fileName = @"C:\ERAFile\" + filename1 + fileCount + curDate + ".txt";
int filesize = outFile.Length;
FileList.Append(fileName + "\r\n");
FileStream fs = File.OpenRead(filename);
byte[] buffer = new byte[outFile.Length];
fs.Read(buffer, 0, buffer.Length);
ZipEntry zipentry = new ZipEntry(filename);
zipentry.Size = fs.Length;
fs.Close();
crc.Reset();
crc.Update(buffer);
zipentry.Crc = crc.Value;
zipos.PutNextEntry(zipentry);
zipos.Write(buffer, 0, buffer.Length);
}
zipos.Finish();
zipos.Close();
Label2.Text = FileList.ToString();
Label2.Visible = true;
}
|
|
|
|
|
There is a part of a web-text:
<asp:Table ID="Table1" runat="server" Height="112px" Width="639px" Visible="False">
<asp:TableRow runat="server" HorizontalAlign="Center">
<asp:TableCell runat="server"><asp:Label ID="LabelRecordNumber01" runat="server" Text="Запись №" Width="78px"></asp:Label>
<asp:TextBox ID="TextBoxRecordNumber01" runat="server" ReadOnly="True" Width="50px"></asp:TextBox>
</asp:TableCell>
<asp:TableCell runat="server">
<asp:Label ID="Label19" runat="server" Text="от 2006/08/13" Width="177px"></asp:Label>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server" HorizontalAlign="Center">
<asp:TableCell runat="server" BorderColor="Turquoise" BorderStyle="Solid" Width="180px">
<asp:Label ID="Label4" runat="server" Text="John Ponton" Width="172px" Font-Size="Large"></asp:Label><br />
<asp:Label ID="Label9" runat="server" Text="John@gmail.com" Width="172px"></asp:Label>
</asp:TableCell>
<asp:TableCell runat="server" Width="440px">
<textarea cols="1" rows="1" readonly="readonly" id="TextareaMessage01" style="width: 436px; height: 129px"></textarea><br />
<asp:Label ID="Label14" runat="server" Text="Ответ от 2006/08/12" Width="151px"></asp:Label><br />
<textarea cols="1" rows="1" readonly="readonly" id="TextareaAnswer01" style="width: 436px; height: 99px"></textarea>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
I need in my program to assign text value to the TextareaMessage01. I'd like to do:
TextareaMessage01.Text= "Birds are flying";
but VS-2005 doesn't understand this way.
I guess, the answer is around like this:
Table1.Rows[0].Cells[0] ... ???
but what - I do not know. Help, please!
HilSoft
|
|
|
|
|
maybe a TextBox tmpTxtBox = Table1.FindControl("idofcontrol") as TextBox;
?
|
|
|
|