|
Thanks for the response. But it is opening the files in the browser window itself.
e.g., if I click on .doc file link, it should launch MS-Word and the file is to be opened in that application[assumed that MS-Office is already installed]. The same case is with MS-Excel, PDF[PDF reader installed] etc.
Shivanandan C V
|
|
|
|
|
Shivan Nandan wrote: But it is opening the files in the browser window itself.
This is browser dependent and you have zero control over how it displays.
|
|
|
|
|
Hi all,
Very good mrng all.. I am using ajax password strength control. If i move tab key the comment "Very poor" is appearing before entering any text into the textbox. Can any one resolve the pbm by giving your suggestion.
|
|
|
|
|
TextStrengthDescriptions can have 10 text descriptions at max. So you can change "very poor" string and instead you can show a status like "Not entered".
Hope that helps.
Education is not a way to escape poverty — it is a way of fighting it.
|
|
|
|
|
I have a fileupload control in my form for uploading PDF files. The issue is it is working fine in my local host and failing in production server. It is giving error that "Error Uploading File. The path is not of a legal form".
Following is my code:
protected void DocumentUploadButton_Click(object sender, EventArgs e)
{
string errMsg = string.Empty;
string PDFFilename = string.Empty;
string PDFSaveLocation = string.Empty;
if (DocumentFileUpload.HasFile)
{
string DocFileName = Path.GetFileName(DocumentFileUpload.PostedFile.FileName);
string FileExtension = Path.GetExtension(DocumentFileUpload.PostedFile.FileName);
string appPath = System.Web.HttpContext.Current.Request.ApplicationPath;
if (!appPath.EndsWith("/", StringComparison.Ordinal))
{
appPath = String.Concat(appPath, "/");
PDFFilename = Path.GetFileName(DocumentFileUpload.PostedFile.FileName);
ViewState["PDFFilename"] = PDFFilename;
PDFSaveLocation = Server.MapPath(String.Concat(appPath, "/tmp/")) + PDFFilename;
Label3.Text = "PDFFileName: " + PDFFilename;
Label1.Text = "PDFLocation: " + PDFSaveLocation;
DocumentFileUpload.PostedFile.SaveAs(PDFSaveLocation);
}
try
{
Guid g = AddFile(DocumentFileUpload.FileBytes, PDFFilename);
ViewState["DocumentFileId"] = g;
File.Delete(PDFSaveLocation);
DocumentUploadedCustomValidator.IsValid = true;
}
catch (Exception ex)
{
string strmsg = ex.Message;
Label4.CssClass = "ErrorMessagesLabel";
Label4.Text = "Error Uploading File. " + strmsg;
}
}
Any idea what is the issue? Please help.I am not getting any head and tail of the issue since it is working fine in local system. It is not even printing the path and pdf file name.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Did you checked the path where the file is getting upoloaded on production?
Cheers!!
Brij
|
|
|
|
|
I tried to get the path from where it is getting uploaded. For that purpose, I have adde a label control to print the path , Label1.Text = "PDFLocation: " + PDFSaveLocation;, But that itself, is not printing.
Even the the PDFFilename itself is not printing, Label3.Text = "PDFFileName: " + PDFFilename;
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
meeram395 wrote: The issue is it is working fine in my local host and failing in production server.
Make sure the Folder where you are uploading files is exists.
Now, There could be the issue with Folder Permission . In Local System, your .NET Application runs with ASP.NET Engine , which having the all kinds of permission that it can writes on your disk.
No, In Production when you have Hosted the sites on IIS Server, IIS run by default "Network Service" Identity, which having the minimum permission to read the files from server, NO Write Access .
Possible Resolution :
1. Give the Write Access Permission to Everyone for that Folder where you are uploading file.
2. Create a Separate Application Pool for you web application, Change the Identity of the Application pool to "Local System " which allows client to Write on your Server.
Hope This Will Help You
|
|
|
|
|
Thanks for your answer.
I am not getting the path of the production server even though I tried to print using a label control. So I think I will go for the second resolution. Can you please tell me how can I create the application pool? Any articles would suffice.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
meeram395 wrote: I am not getting the path of the production server even though I tried to print using a label control.
Need to check Code again.
meeram395 wrote: Can you please tell me how can I create the application pool? Any articles would suffice.
Yes, This is from one of my article,Please have a look on Application Pool Section . If you have interest, then you can read it all
|
|
|
|
|
Well, all you are doing is uploading the file to a tmp directory which is in your application root, right? If yes, you don't have to use Request.ApplicationPath . Also many other code what you have given is unnecessary. Here is a modified version
string fileName = Path.GetFileName(DocumentFileUpload.PostedFile.FileName);
string saveFilePath = Path.Combine(Server.MapPath("/tmp/"), fileName);
DocumentFileUpload.PostedFile.SaveAs(saveFilePath);
ViewState["PDFFilename"] = fileName ; Note : I have written this directly on CP, so excuse the syntactic issues.
|
|
|
|
|
my data source contain table with the name of Coupon_Info having 3 records
plz help
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False" CellPadding="4"
DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None"
style="z-index: 1; top: 413px; left: 285px; position: absolute; height: 172px; width: 476px; margin-right: 88px"
onrowcancelingedit="GridView1_RowCancelingEdit"
OnRowUpdating="UpdateRecord"
onrowediting="GridView1_RowEditing" PageSize="5">
<FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#E3EAEB" />
<Columns>
<asp:TemplateField HeaderText="Date" HeaderStyle-HorizontalAlign="Left" SortExpression="RecievingDate">
<ItemTemplate >
<asp:Label ID="lbl1" runat ="server" Text ='<%# Eval("Coupon_Info.RecievingDate") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtDate" Width="100px" runat="server" Text='<% Bind("Coupon_Info.RecievingDate") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Coupon" SortExpression="CouponName">
<EditItemTemplate>
<asp:TextBox ID="txtcoupon" Width="100px" runat="server" Text='<% Bind("CouponType.CouponName") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblcoupon1" Width="100px" runat="server" Text='<%# Eval("CouponType.CouponName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Serial Start" SortExpression="Serial_Start">
<EditItemTemplate>
<asp:TextBox ID="txtstart" Width="100px" runat="server" Text='<% Bind("Coupon_Info.Serial_Start") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblstart1" Width="100px" runat="server" Text='<%# Eval ("Coupon_Info.Serial_Start") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="End" SortExpression="Serial_End">
<EditItemTemplate>
<asp:TextBox ID="txtend" Width="100px" runat="server" Text='<% Bind("Coupon_Info.Serial_End") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblend1" Width="100px" runat="server" Text='<%# Eval ("Coupon_Info.Serial_End") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Recieved By" SortExpression="Recieved_By">
<EditItemTemplate>
<asp:TextBox ID="txtby" Width="100px" runat="server" Text='<% Bind("Coupon_Info.Recieved_By") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate >
<asp:Label ID="lblby1" Width="100px" runat="server" Text='<%# Eval("Coupon_Info.Recieved_By") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Edit" ShowHeader="False">
<EditItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update" Text="Update"></asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"></asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White"
Height="4px" />
<EditRowStyle BackColor="#7C6F57" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
</asp:Panel>
</div>
</asp:Panel>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:Coupon ManagementConnectionString9 %>"
SelectCommand="SELECT Coupon_Info.RecievingDate AS Date, CouponType.CouponName AS Name, Coupon_Info.Serial_Start AS [Serial Start], Coupon_Info.Serial_End AS [Serial End], Coupon_Info.Recieved_By AS [Recieved By] FROM Coupon_Info INNER JOIN CouponType ON Coupon_Info.Coupon_TypeID = CouponType.CouponTypeID">
</asp:SqlDataSource>
in C#
public partial class CouponRecieving : System.Web.UI.Page
{
SqlConnection cnx = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|Coupon Management.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
SqlDataAdapter da1 = new SqlDataAdapter();
DataSet ds = new DataSet();
SqlCommand cmd = new SqlCommand();
DataTable dataTable;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
FillVendorGrid();
}
}
private void FillVendorGrid()
{
dataTable = new DataTable();
cmd.Connection = cnx;
cmd.CommandText = "SELECT Coupon_Info.RecievingDate AS Date, CouponType.CouponName AS Name, Coupon_Info.Serial_Start AS [Serial Start], Coupon_Info.Serial_End AS [Serial End], Coupon_Info.Recieved_By AS [Recieved By] FROM Coupon_Info INNER JOIN CouponType ON Coupon_Info.Coupon_TypeID = CouponType.CouponTypeID";
da1 = new SqlDataAdapter(cmd);
da1.Fill(dataTable);
GridView1.DataSource = dataTable;
GridView1.DataSourceID = String.Empty;
}protected void UpdateRecord(object sender, GridViewUpdateEventArgs e)
{
GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex];
try
{
cnx.Open();
SqlCommand updateCmd = new SqlCommand("UPDATE [Coupon_Info,CouponType] SET [Coupon_Info.RecievingDate]=@date,[CouponType.CouponName]=@Coupon,[Coupon_Info.Serial_Start]=@Start,[Coupon_Info.Serial_End]=@End,[Coupon_Info.Recieved_By]=@By ", cnx);
updateCmd.CommandType = CommandType.Text;
updateCmd.Parameters.Add("@date", SqlDbType.Date).Value = ((TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text;
updateCmd.Parameters.Add("@Coupon", SqlDbType.NVarChar ,60).Value = ((TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text;
updateCmd.Parameters.Add("@Start", SqlDbType.BigInt).Value = Convert.ToInt32(GridView1.Rows[e.RowIndex].Cells[2].Text);
updateCmd.Parameters.Add("@End", SqlDbType.BigInt ).Value = Convert.ToInt32(GridView1.Rows[e.RowIndex].Cells[3].Text);
updateCmd.Parameters.Add("@By", SqlDbType.NVarChar ,50).Value = ((TextBox)GridView1.Rows[e.RowIndex].Cells[4].Controls[0]).Text;
updateCmd.Connection = cnx;
cnx.Open();
updateCmd.ExecuteNonQuery();
cnx.Close();
}
catch (Exception ex)
{
ErrorMessage.Text = ex.Message;
}
finally
{
cnx.Close();
cnx.Dispose();
}
}protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex =e.NewEditIndex;
FillVendorGrid();
}
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex = -1;
FillVendorGrid();
}
}
|
|
|
|
|
Hi..
can someone tell me.. how to used POST and GET method in asp.net / vb
i don't know how to retrieve form variable from other form...
plz.. can sumone help me?
|
|
|
|
|
syaiful_86 wrote: can someone tell me.. how to used POST and GET method in asp.net / vb
i don't know how to retrieve form variable from other form...
GET and POST are standart HTML methods of a FORM submitting. Please have a look
get and post method in asp.net
|
|
|
|
|
HI.. Ok..
lets say that
Page 1 :
i have
form1 (action=page2),Text1,Text2,Text3,Submit button, Reset Button.
Page 2:
i have
form2,
how could i retrieve value from page1 in asp.net?
using REQUEST.Form or anything else?
I've try using request.form but its count 0..
|
|
|
|
|
Can anybody tell me how do i put a java applet in asp.net page (.net 3.5)
Also, is it possible to show slideshow in a small box withing an asp.net page. if yes, Please tell me how?
|
|
|
|
|
ashutosh_karna wrote: Can anybody tell me how do i put a java applet in asp.net page (.net 3.5)
Here is my complete article on Java and .net integration. Hope this will help you.
ashutosh_karna wrote: Also, is it possible to show slideshow in a small box withing an asp.net page. if yes, Please tell me how?
Why you want to use java applet for this. Normal javascript can do it easily. If you are going to use java applet that is an overhead. If Applet is disabled in the browser it will not work.
|
|
|
|
|
I have a some report messages in a content place holder within a master page in .aspx page.
I want to put a "Save Button" on my page, which saves the webpage to user's computer (just like "SaveAs File dialog box" in windows application". Can anybody tell me how do I save a webpage in .txt or .pdf or .doc or .htm format (any of theses) on button click event
|
|
|
|
|
You want to save the page content in client system when user click on save button on you page?
|
|
|
|
|
|
When they push the button, you render the content of the page to a stream and pass that with a content header to say it's a file. To save as anything other than plain text, requires more work, a third party add in, or the Microsoft tools for office. htm is easy, that's what you were sending in the first place, so you don't need to reformat it at all, just stream it.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I have a gridview in webpage, which generates a new row with 2 textboxes on clicking a button by end - users. Now, I dont want my users to press a button each time they want to add a new row & then enter some data in textboxes. Instead, I want to call button_click method as soon as "tab" key is pressed and focus is automatically set to the next row's first textbox.
How can I do it in asp.net with C#?
Please also, tell which namespace is to be added.
|
|
|
|
|
With javascript. Call the method that your click event calls, in js, in the right event of the tab.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi All,
I need to a regular expression for 'RFC 3986 URI' validation. Can someone help me?
Thanks...
MJ_Developer
|
|
|
|
|
mj_developer wrote: I need to a regular expression for 'RFC 3986 URI' validation
RFC 3986 URL Validation
May this will help you
|
|
|
|