|
Hi all, I am facing a problem in generating an excel file from an ASP.Net Web Application. When I run the code from within Visual Studio 2005, the file generates properly without any problem, whereas, When I configure the application in IIS and run the same from there, no file is getting generated and the page seems to be hung up. What might be the reason.
I have included Microsoft.Office.Interop.Excel.dll 11.0. Kindly help me.
Thanks in advance.
Neeraj
-----Have A Nice Day-----
|
|
|
|
|
I guess... there might be some permission issue, where the IIS user cannot write on the directory.
Abhishek Sur
|
|
|
|
|
Hi Abhishek, how do I set the permission for the anonymous user on the folder where I wish to write the excel file.
-----Have A Nice Day-----
|
|
|
|
|
Just right click on the folder and add permission to the users you want.. isnt this what you are doing?
Abhishek Sur
|
|
|
|
|
hello,
How to create a folder for storage uses accessed from iis account only.
Do someone have any idea.
best regards
dghdfghdfghdfghdgh
|
|
|
|
|
Give the Sharing and Security Right to user ASPNET for the folder. You will be able to the folder for storage purpose.
|
|
|
|
|
Hello everybody,
This is my problem.
I'm using textboxs and getting the values from the users. The values from the text boxes are read and stored in the SQL database and as well as binded to the grid. There is NO connection between the grid and the sql database. I want to delete a particular row corresponding to a primary key. I also don't use arraylist to index and delete it. I want to kow whether there is any provision to delete a record in the grid without the sql databse help or the arraylist help. Plz help me out in this. Thanks in anticipation.
Regards,
prabhu
Prabhuram Natarajan
|
|
|
|
|
Every Grid is bound to a DataTable.
You store the datatable in memory, when user request a row delete from grid. Remove the Row from datatable and rebind table to grid.
|
|
|
|
|
But is it possible to delete it without storing the datatable to memory?
Prabhuram Natarajan
|
|
|
|
|
Amandeep Singh Bhullar wrote: Every Grid is bound to a DataTable.
This is not correct.
GridView/DataGrid can take any IEnumerable type as data source.
|
|
|
|
|
Hi, i am reading data from csv file to datatable. But some data is not reading. if the columns contains data with hyphens "234-456" is not reading. if hypen appears in text like 'sat-ish' is reading...why?
if (_fileexten == ".csv")
{
string str = Path.GetFileName(_filename);
OdbcConnection conn = new OdbcConnection("Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + _fpath + "\\;Extensions=asc,csv,tab,txt;Persist Security Info=False");
conn.Open();
string sql_select = "select * from [" + str + "]";
OdbcDataAdapter myCommand = new OdbcDataAdapter(sql_select, conn);
myCommand.Fill(myDataSet, "csv");
dt = myDataSet.Tables[0];
conn.Close();
myCommand.Dispose();
}
G. Satish
|
|
|
|
|
Well, I think the OleDbProviders chooses according to the no of occurance basis.
To honor mixed mode, I think you need to include some Extended properties.
Use
Extended Properties=HDR=YES;IMEX=1
IMEX = 1 will honor mixed mode and choose everything as string.
To do that you also need to set the registry engine
HKLM\Software\Microsoft\Jet\4.0\Engines\YourEngine\ImportMixedTypes = Text
This fixed once, to me.. hope this works for you too...
Abhishek Sur
|
|
|
|
|
I'm filling a dropdownlist using an update panel. Following is the code:
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:DropDownList ID="CompanyList" runat="server"
Height="22px" Width="155px" AutoPostBack="True" AppendDataBoundItems="true"
onselectedindexchanged="CompanyList_SelectedIndexChanged" >
<asp:ListItem Selected ="True" Text="--Please Select--"></asp:ListItem>
</asp:DropDownList>
<br />
<asp:DropDownList ID="ProjectList" runat="server" AppendDataBoundItems="true"
Height="23px" Width="155px" >
<asp:ListItem Selected ="True" Text="--Please Select--"></asp:ListItem>
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress2" AssociatedUpdatePanelID="UpdatePanel2" runat="server" >
<ProgressTemplate>
<span class="ProgressBar">
Data Loading. Please Wait....</span></ProgressTemplate>
</asp:UpdateProgress>
Everything is working fine and data is populating in both the dropdownlists without postbacks. After saving the data, I need to clear the dropdownlist by keeping the item "--Please Select--". When I say, ProjectList.Items.Clear();, all the items are getting cleared. I am not sure how to achieve this. Anybody please provide any help on this.
Thanks,
|
|
|
|
|
meeram395 wrote: ProjectList.Items.Clear();, all the items are getting cleared
it will clear all the Items.
You can achieve your task using two differnt ways
Firstly,
After clearing the Dropdown add new item "--Please Select--"
Secondly,
Try using method Remove or RemoveAt or list.Items
|
|
|
|
|
Thank you. i have added it again and it worked. Thanks a lot.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Thank you. I have added it again and it got worked.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Hi, Iam using Repeater control in my Project. I want to get the specified values from the row when the clicked? Can u give the code or any Idea? Its urgent. pls...
karthick_gc
|
|
|
|
|
Karthick_gc wrote: Its urgent. pls...
Yeah I know
Since it is urgent, I can give you a hint. No server side events are fired when an item is clicked in the repeater. Work with JS and use the click event.
|
|
|
|
|
In case of repeaters, the item template will repeat for each data as HTML during rendering process.
You can have to find a mechanism to detect the row from html. Place the ID of the row within one of your control's attributes, so that you could find that when user clicks the control.
If the control is a button, you can use ItemCommand event handler from the serverside.
You can use ((Button)e.CommandSource) from the Repeater_OnItemCommand EventHandler to find the button within the repeater.
Abhishek Sur
|
|
|
|
|
Hi to all,
I am stucked in updating a datagrid when user changes the textbox value.
I am binding the datagrid through a datatable.
What I am doing is:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class Mycart : System.Web.UI.Page
{
float total_Price = 0;
int total_items = 0;
int quanti;
string pro_id;
string desc;
string id;
int qty3;
float unitprice;
float cost;
DataTable dt;
DataTable dt2;
DataGridItem dgItem;
protected void Page_Load(object sender, EventArgs e)
{
if(!Page.IsPostBack)
{
if (Session["Cart"] == null)
{
dt = new DataTable();
dt.Columns.Add("REF", typeof(string));
dt.Columns.Add("Description", typeof(string));
dt.Columns.Add("QTY", typeof(int));
dt.Columns.Add("Price", typeof(float));
dt.Columns.Add("Cost", typeof(float));
get_data();
Session["Cart"] = dt;
}
else
{
dt = (DataTable)Session["Cart"];
get_data();
Session["Cart"] = dt;
}
}
}
public void get_data()
{
pro_id = Request.QueryString["pr_id"];
quanti = Convert.ToInt32(Request.QueryString["quant"]);
if (pro_id != null)
{
SqlConnection con = new SqlConnection("Server=.; Database=eclsc; Trusted_Connection=yes");
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "select ICEMACHINES.product_id,ICEMACHINES.sh_desc,ICEMACHINES.price from ICEMACHINES where ICEMACHINES.product_id LIKE @product_id union select GLASSWARE.product_id,GLASSWARE.sh_desc,GLASSWARE.price from GLASSWARE where GLASSWARE.product_id LIKE @product_id ";
cmd.Parameters.Add("@product_id", SqlDbType.NVarChar, 50).Value = pro_id;
cmd.Connection.Open();
SqlDataReader rdr = cmd.ExecuteReader();
ArrayList arRole1 = new ArrayList();
while (rdr.Read())
{
desc = (rdr["sh_desc"]).ToString();
id = (rdr["product_id"]).ToString();
unitprice = Convert.ToSingle((rdr["price"]));
cost = unitprice * quanti;
}
cmd.Connection.Close();
DataRow myrow = dt.NewRow();
myrow["REF"] = id;
myrow["Description"] = desc;
myrow["QTY"] = quanti;
myrow["Price"] = unitprice;
myrow["Cost"] = cost;
dt.Rows.Add(myrow);
dt.AcceptChanges();
Session["data"]= dt;
DataGrid2.DataSource = dt;
DataGrid2.DataBind();
}
else
{
int a = 1;
}
total_items = total_items + quanti;
total_Price = total_Price + cost;
Session["items"] = total_items;
Session["value"] = total_Price;
}
protected void BtnUpdate_Click(object sender, EventArgs e)
{
dt = (DataTable)Session["Cart"];
CheckBox chkSelected = new CheckBox();
foreach (DataGridItem dgItem in DataGrid2.Items)
{
chkSelected = (CheckBox)dgItem.FindControl("chkSelection");
if (chkSelected.Checked == true)
{
TextBox TxtQTY = (TextBox)dgItem.Cells[2].FindControl("TxtQTY");
int Txt2 = Convert.ToInt32(TxtQTY.Text);
Label lblProduct_Id = (Label)dgItem.Cells[0].FindControl("lblProduct_Id");
string id2 = lblProduct_Id.Text;
Label lblDescription = (Label)dgItem.Cells[1].FindControl("lblDescription");
string desc2 = lblDescription.Text;
Label lblPrice = (Label)dgItem.Cells[3].FindControl("lblPrice");
float price2 = Convert.ToSingle(lblPrice.Text);
Label lblCost = (Label)dgItem.Cells[3].FindControl("lblCost");
float cost2 = Convert.ToSingle(lblCost.Text);
float final_cost = price2 * Txt2;
DataRow myrow = dt.NewRow();
myrow["REF"] = id2;
myrow["Description"] = desc2;
myrow["QTY"] = Txt2;
myrow["Price"] = price2;
myrow["Cost"] = final_cost;
dt.Rows.Add(myrow);
dt.AcceptChanges();
Session["data"] = dt;
}
}
DataGrid2.DataSource = dt;
DataGrid2.DataBind();
}
protected void BtnSave_Click(object sender, EventArgs e)
{
}
protected void BtnRetrieve_Click(object sender, EventArgs e)
{
}
protected void BtnContinue_Click(object sender, EventArgs e)
{
Response.Redirect("Default2.aspx");
}
protected void BtnCheckout_Click(object sender, EventArgs e)
{
Response.Redirect("Checkout.aspx");
}
}
Through this functionality I am able to update the datagrid but the problem is:
Suppose a user added two items in the datagrid.Then he checks one of the row to update.Then after updating it is showing three items.Instead of updating the same row it is adding the updated row below the previous two entries.
I am unable to get rid of this problem.
Thanks in advance.
cheers,
sneha
|
|
|
|
|
Hi to all,
I have a datagrid in I am having a checkbox in every row.What I want to do is
to delete the row from the datagrid for which checkbox is checked.
How to find index of the datagrid which is checked?
How to delete that particular row from the datagrid?
It is not interecting with the database.
Thanx in advance.
cheers,
sneha
|
|
|
|
|
I need to create a Menu with 3 level in my web application using Menu Control in ASP.net.
Can someone tell how should I build my database structure, queries and in C# to do so.
Ex :
Menu1
|_ Menu1_1
|_ Menu1_2
Menu2
|_ Menu2_1
|_ Menu2_2
|_ Menu2_2_1
|_ Menu2_2_2
|
|
|
|
|
Try Java script. It is easy to create any type of Menu.
|
|
|
|
|
Dear friend i have the concept of Url rewriting.
But stuck when go for coding.I need code in c# for Url Rewriting.
Please help me
|
|
|
|
|
Don't re-invent the wheel. Use opensource programs like this[^]. It is tested and proven performance. You can get it working with minimum effort.
|
|
|
|