|
.<br />
.<br />
.<br />
public partial class MyPage: System.Web.UI.Page<br />
{<br />
public SqlConnection sqlConn = new SqlConnection();<br />
public DataSet ds = new DataSet();<br />
public SqlDataAdapter sqlAdapter = new SqlDataAdapeter();<br />
.<br />
.<br />
.<br />
.<br />
.<br />
}
|
|
|
|
|
this doesn't do the jojb i tried exactlly this code with public visibility but it doesn't work
any ideas ?
try to be good if you can't be the best
|
|
|
|
|
hi,
i have a problem in datagrid,i have one grid in that grid i have 4 labels now i populate my label with values in html like ""<%#DataBinder.Eval(Container.DataItem , "EvalPointID")%> "" now i want to acces this value in my code like this "Dim lbl5 As Label = dgi.FindControl("Label5")
lbl5 = dgi.Cells(0).Controls(1)
type_id = lbl5.Text"
the is valie is not come in the type_id and this error in shown "Invalid cast exception"
kindly tell me how can i acces the value fromt he label
tell me the proper way ,i m wating
with regards
|
|
|
|
|
Dim lbl5 As Label = ctype(dgi.FindControl("Label5"), Label)
the next line is wrong lbl5 = dgi.Cells(0).Controls(1)
lbl5 should already equal the control in the grid row.
Also, check and make sure the datagriditem is a row and not the header or footer.
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
try the following code to access the lable value
lbl5.text=dgi.Items(i).Cells(j).Text
Note
****
i -> row
j -> col
|
|
|
|
|
Hi,
i've developed a web application to retrieve the data from Sqlserver 2000 and fill it in the Dataset then, using
the dataset i'l write the data into the Excel template file by opening the Excel and copying the excel sheet
writing the data into it. After writing the data i'l save the template file as a new file with different name. then
i'm closing the Excel books, sheets and quits the excel application.
My problem is after closing and quiting the Excel application also the Excel.exe is still running idle in the
processor, so i can't open the excel file. Only After killing the Excel.exe only i'm able to open the saved Excel
File.
In my application multiple user can access the same application so multiple Excel.exe will be running in the
process. How to find out my Excel.exe and kill it.
Here is my code:
using System;
using Excel;
using System.IO;
using System.Net;
using System.Collections;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Diagnostics;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Runtime.InteropServices;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using RealImageReports.Reports;
using RealImageReports.Include;
namespace RealImageReports
{
public class ExcelWriter
{
Excel.ApplicationClass _excel = new Excel.ApplicationClass();
Excel.Workbooks oBooks;
Excel._Workbook oBook;
Excel.Worksheet ws;
public void WorkSheetOpen(string path, string filename)
{
oBooks = _excel.Workbooks;
oBook = oBooks.Open(path + filename, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing );
_excel.Visible = true;
}
public void WriteData(string path, string filename, DataSet _ds, string theatre, string Ads, string
STime, string ETime)
{
ws =(Worksheet) oBook.Worksheets[1];
ws.Activate();
ws.Copy(ws, Type.Missing);
ws.Name = theatre;
ws=(Worksheet) oBook.Worksheets[theatre];
ws.Activate();
FillHeadersParam(theatre, Ads, STime, ETime);
FillDataRows(ws, _ds);
}
public void FillHeadersParam(string theatre, string Ads, string STime, string ETime)
{
AddItemToSpreadsheet(5, 2, ws, theatre);
AddItemToSpreadsheet(5, 6, ws, STime);
AddItemToSpreadsheet(6, 2, ws, Ads);
AddItemToSpreadsheet(6, 6, ws, ETime);
AutoFitColumn(ws, 2);
AutoFitColumn(ws, 5);
}
public void WorkSheetClose()
{
ws =oBook.Sheets.get_Item(1) as Excel.Worksheet;
ws.Activate();
ws.Visible = Excel.XlSheetVisibility.xlSheetVeryHidden;
oBook.Save();
oBook.Close(XlSaveAction.xlSaveChanges,Type.Missing, Type.Missing);
oBooks.Close();
oBooks.Application.Quit();
_excel.Quit();
Marshal.ReleaseComObject(ws);
Marshal.ReleaseComObject(oBook);
Marshal.ReleaseComObject(oBooks);
Marshal.ReleaseComObject(_excel);
}
}
}
keenly waiting for your reply.
Regards,
Selvaraj.A
|
|
|
|
|
I had the same issue and I found that opening excel on the web server is a poor solution. What I would do is use one the following three methods to create an excel file.
1. SQL Reporting Services You can pass all your variables in the query string.
2. Crystal Reports works just as well.
3. SQL DTS job you can execute it from your code with a reference to the DTS .dll.
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
ToddHileHoffer wrote: I had the same issue and I found that opening excel on the web server is a poor solution
It is - and in fact MS warn against it.
Another solution is to code an ActiveX control...
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
Hi
The code below creates a save button, server side. How can I enable / disable this client side without a round trip to the server, as I can't get the ID as it is mangled to something like ctl00_contentplace_savebutton...
private void AddSaveButton()
{
Button btn = new Button();
btn.ID = "savebutton";
btn.Enabled = false;
btn.Text = "save modified jobs";
btn.Command += new CommandEventHandler(SaveChanges);
btn.CommandName = "SaveChanges";
mode.Controls.Add(btn);
}
Regards
Angel
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
Simple Angel - just register some client side script and then call the function you've registered when you need it!
private void AddSaveButton()
{
Button btn = new Button();
btn.ID = "savebutton";
btn.Enabled = false;
btn.Text = "save modified jobs";
btn.Attributes.Add("Name", "hello");
btn.Command += new CommandEventHandler(SaveChanges);
btn.CommandName = "SaveChanges";
mode.Controls.Add(btn);
<font color=red>
Page.ClientScript.RegisterStartupScript(GetType(), "saveScript",
String.Format("function EnableSave( isDisabled )"+
"{{ var saveButton = document.getElementById(\"{0}\");"+
"saveButton.disabled=isDisabled;}}", btn.ClientID), true);</font>
}
It doesn't get much better than answering your own questions...until somebody comes along and blows your solution out of the water.
I'm waiting...
Regards
Angel
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
Hello,
I have a big Problem with uploading programmatically docs into a WSS Documentlist.
I must load the Document an set MetaDatas ( column values ) for it. I must do it in ONE step, because I want only one Version of the file for this Process.
The only way to do this ist to use Frontpage RPCs.
This work fine... but !
If a property I want to set has special chars ( äöü&|; for example ), and I put it in this MetaInfo string, the server gives me an "unknown error code". So I think I must encode this string.
Do anyone have experience with this ?
I allready tried to snif various RPC calls from Word with fiddler, but Word do this job on a different way, saving properties in the Doc file, then doing the RPC call without metainfos.
Thanks for answers.
|
|
|
|
|
|
Friends,
In my application i need to send mail to recepients Using POP3 Server. Please tell me how to do this. Now i m working with SMTP Server. Please Help Me.
THanks & Regards
Prya
|
|
|
|
|
check this.
http://www.google.co.in/search?hl=en&q=send+email+pop3+asp.net&btnG=Google+Search&meta=
Best Regards,
Apurva Kaushal
|
|
|
|
|
see
System.Web.Mail.SmtpServer
|
|
|
|
|
POP3 is for retrieving email from the email server to the client. SMTP is a MTA (mail transfer agent) responsible for sending mail to and between mail servers. You can not send email to someone using POP3. You can send it to their email server using SMTP. They can then retrieve your email from their mail server with their email client that probably uses POP3 (or maybe IMAP).
Or maybe I am misunderstanding the question?
|
|
|
|
|
Hi,somebody told me to try the onkeypress event of a input object
it seems logic but the HTML text doesn't fire a post back & even that i tried this idea but it doesn't work
look , for example i have a list of guests in my listbox & i want when i type something in a textbox over that list the guests that only the guests that have the name start whith these letters stay in the listbox
can you have any idea how can i do that please ??
try to be good if you can't be the best
|
|
|
|
|
well if you did get it to work it would post back on every type. That really would be un-sitely.
So using javascript i think the even is onKeyPress="CallMyFunction();"
then have a javascript function that filters the list box.
Its a SELECT element so look that up in msdn. You might have to store the results in another object and add them. Although there is probably a way to make the listbox set a visible property on each item.
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
Is it possible to have an imagebutton in datagrid. When clicked will produce a larger version in detailsview
|
|
|
|
|
Give some more details of the problem. Whta i have understood is on click of a imagebutton(which is inside the datagrid) you want to display some more details of that record. If it is so then you can easily do that. What you need to do is to place the image button in the itemtemplate of the datagrid and handle the click event which you can do with onItemCommand event of the datagrid.
Best Regards,
Apurva Kaushal
|
|
|
|
|
I have a database with name, image, etc and as far as i know you cannot click on an image in a datagrid so i want to us the datagrid to show like thumbnails of the images, and when clicked, retrieve the the image and other data from the database and display it in detailsview using master/detail.
|
|
|
|
|
You can display the image in the datagrid and also can handle the click event of that image. But do you have your image saved in the database or only the image name which you are retreiving from the database and displaying the image from a certain location?
Best Regards,
Apurva Kaushal
|
|
|
|
|
To be honest, when i filled the database i can't remember whether the image is stored in the database or just the location address. What would be the difference?
Thanks for talking to me!!!!
|
|
|
|
|
There is too much difference, actually in normal case only the image name is being stored in the database and the image is being saved at some place at the server, so while retreiving only you have to get the name and attach it with the path of the image(where the image is stored) and display it. In the other case the complete image is being save into the database which is rather a bit complicated. You need to have separate datatype in the database to store the image. For details of how to save image to the database you can check this link:
http://www.codeproject.com/aspnet/PicManager.asp
Best Regards,
Apurva Kaushal
|
|
|
|
|
Thanks for the link. Iam using Sqlexpress for now and my code is in VB.Net and ASP.Net. Will this link still apply.
-- modified at 8:23 Tuesday 1st August, 2006
|
|
|
|