|
Hello,
I am developing Web Application in that I am storing HTTPPostedFile in Datatable.But after that I am not able to fetch that File in HTTPPostedFile object.
I had written code as,
HttpPostedFile obj_Posted;
sobj_Posted =((HttpPostedFile)dt.Rows[0]["HttpPostedFile"]).FileName;
But here error comes as invalid type cast
swapnil Bhavsar
|
|
|
|
|
Hi,
What is the datatype of the column of the table into which you are storing the file?
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
|
Hi,
I have a web application(ASP.net, C#) in which the user is be able to download a .cab file to the PC by clicking on a button after making a file selection. I tried many methods for accomplishing the download task.
The code i tried is given below.
Response.ContentType = "APPLICATION/OCTET-STREAM";
System.String disHeader = "Download; Filename=\"" + myfilename+ "\"";
Response.AppendHeader("Content-Disposition", disHeader);
System.IO.FileInfo fileToDownload = new System.IO.FileInfo(myfilepath);
Response.Flush();
Response.WriteFile(fileToDownload.FullName);
or
FileStream MyFileStream = new FileStream(myfilepath, FileMode.Open);
long FileSize;
FileSize = MyFileStream.Length;
byte[] Buffer = new byte[(int)FileSize];
MyFileStream.Read(Buffer, 0, (int)MyFileStream.Length);
MyFileStream.Close();
Response.ContentType = "application/octet-stream";
Response.AddHeader("content-disposition", "attachment; filename=" + myfilename);
Response.BinaryWrite(Buffer);
When i tried these two methods, i could download the files to the PC. The user has to copy the cab file to the Pocket PC device for installing it. The file downloaded through the web application may have some problem so that it cannot be installed on the Pocket PC.
When i tried to install the original file from the repository, it worked fine. It means that there occurs some problem with the cab file while it is being downloaded.
The original file is having the size 420 KB. But the file downloaded is having size 432 KB.
Could anybody guide me to solve the problem?
Thanks in advance.
Nicejith
|
|
|
|
|
|
hi lucjon,
i tried that code.
still i'm getting the same problem..
there occurs some size variation when i'm trying to download file using all these methods..
|
|
|
|
|
Is ASP.NET Ajax v1.0 is free of cost for commercial use? Plz reply with proof that supports your answer. I need this urgent.......... plz help
|
|
|
|
|
Hi, PC Plus Magazine (recent issue, Code it section) states that ASP.NET Ajax (Atlas) 1.0 uses the Microsoft Permissive license. I'm not very good at legal stuff, but from what I read here, I think it can be used commercially.
|
|
|
|
|
I had a problem in sending email from asp.net 2.0.
The code which i have used for sending email follows..
First i have imported some namespaces
<br />
using System.Net;<br />
using System.Net.Mail;<br />
after, in a button click event i have written like this
<br />
string toaddr;<br />
toaddr = "stxvechoor@rediffmail.com";<br />
MailMessage message = new MailMessage();<br />
message.From = new MailAddress("sebastian@atenindia.com");<br />
message.To.Add(new MailAddress(toaddr));<br />
message.CC.Add(new MailAddress("stxvechoor@rediffmail.com"));<br />
message.Priority = MailPriority.High;<br />
message.Subject = "hai";<br />
message.Body = "Test Mail";<br />
SmtpClient client = new SmtpClient();<br />
client.Port = 2095;<br />
client.Host = "mail.ateninc.com";<br />
client.Send(message);<br />
But it showed some error..
Can anyone help me.....
I will be thankful to you...
Sebastian
|
|
|
|
|
Hi,
Which error message you get?
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
First i got the error below
SMTP exception was unhandled by user code..
when i added try..catch... it showed some error like this..
mail sending failed
I couldn't understand these..
will you help me?
thanks
|
|
|
|
|
Hi all,
how to insert one data grid into another datagrid.
ex: if i select one item in one column than it will display new datagrid that should shows the related item details.
|
|
|
|
|
This is an example:
<br />
asp:datagrid id="dgAddresses" runat="server" CssClass="grid" AutoGenerateColumns="False" GridLines="None"<br />
Width="680"><br />
SelectedItemStyle Font-Bold="True" CssClass="grid_itemSelected"></SelectedItemStyle><br />
EditItemStyle CssClass="grid_itemEdit"></EditItemStyle><br />
AlternatingItemStyle CssClass="grid_itemAlternating"></AlternatingItemStyle><br />
ItemStyle CssClass="grid_item"></ItemStyle><br />
HeaderStyle Font-Bold="True" CssClass="grid_header"></HeaderStyle><br />
FooterStyle CssClass="grid_footer"></FooterStyle><br />
Columns><br />
asp:TemplateColumn ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Top"><br />
ItemTemplate><br />
asp:ImageButton ID="ibtnViewUsers" runat="server" CommandArgument='<%#DataBinder.Eval(Container.DataItem, "lngAddressID").ToString()%>' Visible='<%#DataBinder.Eval(Container.DataItem, "CountDP").ToString() == "0" && DataBinder.Eval(Container.DataItem, "CountUsers").ToString() != "0"%>' ImageUrl="../../../../../../images/bo_icons/arrow_yellow_right_12x12.gif" AlternateText="$Click_to_view_users_conected_to_this_address$"><br />
/asp:ImageButton> <br />
/ItemTemplate><br />
/asp:TemplateColumn><br />
<br />
asp:TemplateColumn HeaderText="$Addresses$" ItemStyle-VerticalAlign="Top"><br />
ItemTemplate><br />
asp:DataGrid id="dgUsersConections" runat="server" CssClass="grid" Visible="False" AutoGenerateColumns="False"<br />
GridLines="None"><br />
SelectedItemStyle Font-Bold="True" CssClass="grid_itemSelected"></SelectedItemStyle><br />
EditItemStyle CssClass="grid_itemEdit"></EditItemStyle><br />
AlternatingItemStyle CssClass="grid_itemAlternating"></AlternatingItemStyle><br />
ItemStyle CssClass="grid_item"></ItemStyle><br />
HeaderStyle Font-Bold="True" CssClass="grid_header"></HeaderStyle><br />
FooterStyle CssClass="grid_footer"></FooterStyle><br />
Columns><br />
asp:TemplateColumn HeaderText="$Users$"><br />
ItemTemplate><br />
asp:Label id="lblUsers" runat="server"><br />
<%#DataBinder.Eval(Container.DataItem, "strName").ToString()%><br />
/asp:Label><br><br />
/ItemTemplate><br />
/asp:TemplateColumn><br />
/Columns><br />
/asp:DataGrid><br />
/ItemTemplate><br />
/asp:TemplateColumn><br />
/Columns><br />
/asp:datagrid><br />
Then you have to add an ItemCreated on the outer datagrid (dgAddresses):
<br />
#region Web Form Designer generated code<br />
override protected void OnInit(EventArgs e)<br />
{<br />
InitializeComponent();<br />
base.OnInit(e);<br />
}<br />
<br />
private void InitializeComponent()<br />
{<br />
<br />
this.dgAddresses.ItemCreated += new System.Web.UI.WebControls.DataGridItemEventHandler(this.dgAddresses_ItemCreated);<br />
this.Load += new System.EventHandler(this.Page_Load);<br />
<br />
}<br />
<br />
#endregion
This method shoud look something like this:
private void dgAddresses_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)<br />
{<br />
try <br />
{<br />
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) <br />
{<br />
DataRowView drv = (DataRowView) e.Item.DataItem;<br />
<br />
System.Web.UI.WebControls.ImageButton ibtn = (System.Web.UI.WebControls.ImageButton)e.Item.Cells[0].Controls[1];<br />
ibtn.Click += new System.Web.UI.ImageClickEventHandler(this.ibtnViewConections_Click); <br />
} <br />
} <br />
catch (Exception err) <br />
{<br />
}<br />
}<br />
the ibtnViewConections_Click:
<br />
private void ibtnViewConections_Click(object sender, System.Web.UI.ImageClickEventArgs e)<br />
{<br />
System.Web.UI.WebControls.ImageButton ibtn = (System.Web.UI.WebControls.ImageButton)sender; <br />
DataGridItem dgiRow = (DataGridItem)ibtn.Parent.Parent;<br />
<br />
if(ibtn.CommandName == "")<br />
{<br />
ibtn.ImageUrl = "../../../../../../images/bo_icons/arrow_yellow_down_12x12.gif";<br />
if(dgiRow.ItemType == ListItemType.Item)<br />
{<br />
ibtn.CommandName = "grid_item";<br />
}<br />
else<br />
{<br />
ibtn.CommandName = "grid_itemAlternating";<br />
}<br />
createConnectionsView(ibtn); <br />
}<br />
else<br />
{<br />
dgiRow.CssClass = ibtn.CommandName;<br />
ibtn.ImageUrl = "../../../../../../images/bo_icons/arrow_yellow_right_12x12.gif";<br />
ibtn.CommandName = "";<br />
removeConnectionsView(ibtn); <br />
} <br />
}
The code that adds the inner datagrid:
<br />
private void createConnectionsView(System.Web.UI.WebControls.ImageButton ibtn)<br />
{<br />
DataGridItem dgiRow = (DataGridItem)ibtn.Parent.Parent;<br />
dgiRow.CssClass = "grid_itemSelected";<br />
int lngAddressID = int.Parse(ibtn.CommandArgument);<br />
<br />
My.BusinessLogicObjects.Address bloAddress = null;<br />
try <br />
{<br />
DataView dvUsersToAddress = null;<br />
bloAddress = new My.BusinessLogicObjects.Address();<br />
dvUsersToAddress = bloAddress.GetUsersToAddress(lngAddressID); <br />
<br />
if(dvUsersToAddress.Count != 0)<br />
{ <br />
DataGrid _dgUserConections = (DataGrid)dgiRow.FindControl("dgUsersConections");<br />
_dgUserConections.Width = System.Web.UI.WebControls.Unit.Percentage(100);<br />
_dgUserConections.DataSource = dvUsersToAddress;<br />
_dgUserConections.DataBind();<br />
_dgUserConections.Visible = true;<br />
} <br />
<br />
}<br />
catch (Exception err) <br />
{ <br />
throw new Exception(Error loading result$") + " " + err.Message, err);<br />
} <br />
finally <br />
{<br />
if (bloAddress != null) bloAddress.Dispose(); <br />
bloAddress = null; <br />
}<br />
}
Then to hide the inner datagrid:
private void removeConnectionsView(System.Web.UI.WebControls.ImageButton ibtn)<br />
{<br />
DataGridItem dgiRow = (DataGridItem)ibtn.Parent.Parent; <br />
<br />
DataGrid _dgUsersConections = (DataGrid)dgiRow.FindControl("dgUsersConections"); <br />
_dgUsersConections.Visible = false;<br />
<br />
}
Hope it helps
Thomas
|
|
|
|
|
Hi to all,
I am using .NET2003, while run the Project it displaying this kind of Errors.
A project with an Output Type of Class Library cannot be started directily.
In order to debug this project, go to the Debugging tab under configuration Settings in Project Properties, and set the Start Action to start External Program or Start URL. Alternatively, You can add a non-library project to this solutions that uses a reference to this project and set it as the startup Project.
I tried with above Paragraph but I am getting same Problems.
Mohan Balal
|
|
|
|
|
Hi, how are you..?
you are trying to run a class library project which has no forms, so you will not be able to run it and you will get this type of error.
you should create one simple form application and link your class library with it and then, try to run that form application ...you will be able to debug your class library project through this path....
Bye.
Chirag Patel
|
|
|
|
|
Thanks for your reply, but. In my solution there are 26 projects. I am not about to debug it. My start Project is Home.aspx.
Mohan balal
|
|
|
|
|
Hi Mohan,
I think the start up project in your solution is your class library.
You have set "Home.aspx" as the start up page but its project is not set as a start up project.
Go to the solution explorer, right click on the project which contains "Home.aspx" and click on "Set As Start Up Project" from the pop up menu.
I hope this will solve you issue.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
Thanks, I think It will solved my Problems
Mohan balal
|
|
|
|
|
Yes, the Problem is solved. Will you tell me what is this means.
The dependency 'CDO' could not be found.
Mohan balal
|
|
|
|
|
Hi,
When do you get this message?
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
That Error will come while comple the Project. After complied it display this kind of Error in IE.
Invalid Site Name: xxxx
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Microsoft.CommerceServer.Runtime.CommerceException: Invalid Site Name: xxxx
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
CommerceException: Invalid Site Name: xxxx ]
Microsoft.CommerceServer.Interop.Configuration.SiteConfigReadOnlyFreeThreaded.Initialize(String bstrSiteName) +4114
Microsoft.CommerceServer.Runtime.Configuration.CommerceResourceCollection..ctor(String siteName) +217
Microsoft.CommerceServer.Runtime.CommerceApplicationModule.InitializeApplication() +193
Microsoft.CommerceServer.Runtime.CommerceApplicationModule.Init(HttpApplication appInstance) +76
System.Web.HttpApplication.InitModules() +100
System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +1295
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +392
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +256
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +414
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
Mohan Balal
|
|
|
|
|
I'm booked until later next week. If that works for you, let me know.
|
|
|
|
|
hi all,,
plz let me know the query to populate a dropdownlist with the database names available in sqlserver....!
|
|
|
|
|
SqlConnection myConnection = new SqlConnection(connectionString);<br />
SqlDataAdapter myCommand = new SqlDataAdapter("select FirstName, LastName from NameList", myConnection);<br />
<br />
SqlDataReader dr;<br />
dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection);<br />
while (dr.Read()) {<br />
myDropDownList.Items.Add(new ListItem((String)dr["FirstName"]+dr["LastName"],"")); <br />
}<br />
dr.Close();<br />
Regards,
Satips.
|
|
|
|
|
hello satips....u ahven't understand my questions
my requirement, i want to populate a dropdownlist with all the database names .....like master,nothwind,.....(my own databses)....etc
i don't want to select some columns from some table
plz help me....!
|
|
|
|