|
Very good article for you.[^]
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.
|
|
|
|
|
Hi ,
i have used a Regular expression to validate the textbox to number format.
<asp:textbox id="TextBox5" runat="server" cssclass="InputField" tooltip="Enter Invoice Date (DD/MM/YYYY)" ontextchanged="TextBox5_TextChanged" maxlength="10" autopostback="True" >="">
<asp:regularexpressionvalidator id="regexpName" runat="server"
="" errormessage="This expression does not validate."
controltovalidate="TextBox5"
validationexpression="^\\d{1,4}(\\.\\d{1,3})?$" enableviewstate="true">;
i have one problem.
that is in textbox, if i enter 22.1 it has to become 22.10
or 22 it has become to format 22.00
protected void TextBox5_TextChanged(object sender, EventArgs e)
{
double a;
a = Convert.ToDouble(TextBox5.Text);
TextBox5.Text = String.Format("{0:f3}", a);
}
it changes the format but it does not validate then.
i.e it is been trigered after the validation.
i.e even if i enter 111111 it just appends zeroes like 111111.000 .
so is there any way i could do the validation and change the format after validation in the textbox.
thanks in advance.
sriharsha
|
|
|
|
|
This works as you expected. I assumed that you have set Textbox1.AutoPostBack = True; Even though the error has been captured by the validation control it doesn't causes validation for textbox. So TextBox5_TextChanged has been fired.
Make the TextBox's CausesValidation = "True". Its working fine as you expected and I have checked it. Please let us know if you find any problem.
Education is not a way to escape poverty — it is a way of fighting it.
|
|
|
|
|
hi,
its working . i made TextBox's CausesValidation = "True".
thanks a lot
i had one more problem , is there any way i could always keep zeroes in the decimal places while typing the number in the textbox.
thanks and regards,
sriharsha
|
|
|
|
|
if you use .net 2.0 or .net 3.5 you can use this .
try here [^]
Education is not a way to escape poverty — it is a way of fighting it.
|
|
|
|
|
hi,
i have tried using masked edit extender and maskedvalidating extender
but the problem here is it allows to enter in any location of the textbox .
i.e if input is 111111.10
no problem
but if input is 1_____.10
it gets converted to 1000000.10 automatically.
or if input is __12_.10
it gets converted 120.10
how can we solve this problem.or is there any other way we can have zeroes in decimal place always in the textbox while typing.
Thanks and regards,
sriharsha
|
|
|
|
|
If you look this control is nothing but a DLL you can modify it as well. So modify this control or try to get a javascript functionality for this one.
Education is not a way to escape poverty — it is a way of fighting it.
|
|
|
|
|
Dear All,
I have an aspx page which contains link to different files created in different application such as .PDF, .doc, .txt, .xls etc.
My requirement is to open each type of files in their respective application window.
I tried System.Diagnostics.Process.Start method, but it does not works in client browser.
Please help, if any one knows how to handle it.
Shivanandan C V
|
|
|
|
|
Shivan Nandan wrote: I tried System.Diagnostics.Process.Start method, but it does not works in client browser.
Yes, It will execute on Server Only.
Shivan Nandan wrote: I have an aspx page which contains link to different files created in different application such as .PDF, .doc, .txt, .xls etc.
My requirement is to open each type of files in their respective application window.
Give Link with each of the file. So that user can able to download file from there. When user will Click on the link he should get message with "Open" , "Save" , "Cancel" Button . Which is the common scenario of web application.
|
|
|
|
|
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?
|
|
|
|