|
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
|
|
|
|
|
Hi All,
I have a problem with "ExecuteNonQuery". When I insert or update my database record then SqlCommands.ExecuteNonQuery always return -1 but same thing I use another sql server its working fine.
I am sure that the actual problem is in my MS-SQL Server.
what should I do? Please me out.........
Thanks
Raj
|
|
|
|
|
For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command. When a trigger exists on a table being inserted or updated, the return value includes the number of rows affected by both the insert or update operation and the number of rows affected by the trigger or triggers. For all other types of statements, the return value is -1. If a rollback occurs, the return value is also -1.
Anyways if you are able post here your piece of code and Sql statement then would be helpful to assist you.
|
|
|
|
|
hi,
No, you could not understand what I want to say. My previous all projects were working fine all ExecuteNonQuery working well but now I don't know all are ExecuteNonQuery return -1. When I used different used another SQl Server installed in other PC. then is works fine.
|
|
|
|
|
Did you read the quote from my Post ?
|
|
|
|
|
Show your code to see where could be problem.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Quote From MSDN NOCOUNT affects the return value
it says "For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command. For all other types of statements, the return value is -1. If a rollback occurs, the return value is also -1."
There is another case that causes it to return -1: if NOCOUNT is set to ON. This usually happens because the query includes the line "SET NOCOUNT ON", but it can also be set in the "Connection Defaults" screen in the SQL Server management tool.
Please go through the statement. Hope this will help you.
|
|
|
|
|
Hi,
I have to print only the cheque numbers on the cheque pad which is a continuous roll of paper.I am printing it using javascript.Only first four cheques includes in the first page. when second page comes,certain height gap comes.After every page,there is some gap in the page break.How can i overcome this problem?
regards
Bill
|
|
|
|
|
You can't. All js can do, is print the current page. You'd have to load all your cheques onto one page and print that page.
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.
|
|
|
|