|
T M Gray wrote: You can't assign the filename in an upload control with javascript
He's probably not asking of assigning values rather He wants value inside.
Regards,
Hiren.
"The more we give of anything, the more we shall get back." - Grace Speare
(you can consider this quote while giving vote also)
Microsoft Dynamics CRM
|
|
|
|
|
Yes i need only the value , in client side i am getting the path value but in server side it is null.
|
|
|
|
|
string fn = Path.GetFileName(inputFile.PostedFile.FileName);
string savepath = Server.MapPath("Exports") + "\\" + fn;
inputFile.PostedFile.SaveAs(savepath);
string[] lines = File.ReadAllLines(savepath);
for (int i = 0; i < lines.Length; i++)
{
} ;
Hope that helps..
Later!
|
|
|
|
|
Thnak u for the reply , I ll try it.
|
|
|
|
|
It works, if u need more help hala at me...
|
|
|
|
|
I have tried it but still i am getting null.
PostedFile.FileName is null.
|
|
|
|
|
You might want to take a look at what exactly you are doing in your Page_Load event...you could be reseting the values
of your controls...
Put the code above in a method e.g.:
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
UploadFile();
}
}
protected void UploadFile()
{
}
|
|
|
|
|
Hi! I recomend you to use Uploadify control of jQuery! Is the easy and best upload control! for multiple or single, max capacity, type of files, queue files in progress, multi browser, etc! Here[^]
|
|
|
|
|
please help me.
in javascript, how will I get the total if i have quantity * price.
example:
var quantiy =2
var price = 5,000
var total =parseInt(quantity.value) * parseFloat(price.value)
why is it above total returns 10 not 10,000.
and if I will remove the parseInt and parseFloat it returns NaN.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
Your code contains couple of errors. Probably you should start JavaScript from beginning. Check the working code.
<SCRIPT language="JavaScript">
<!--
function tot()
{
var quantity =2;
var price = 5000;
var total = parseInt(quantity) * parseFloat(price);
alert(total);
}
</SCRIPT>
Please use appropriate forums to post questions. You should have posted this in Javascript forum.
thatraja |Chennai|India|
Brainbench certifications Down-votes are like kid's kisses don't reject it Do what you want quickly because the Doomsday on 2012
|
|
|
|
|
You do not need to parse either value. They are already both integers
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
musefan wrote: You do not need to parse either value. They are already both integers
Yeah, But It will be useful if he put float value in the variable price like with cents (Ex. 5000.50). Also I was mentioned in my message that the code has couple of errors. Thank you.
thatraja |Chennai|India|
Brainbench certifications Down-votes are like kid's kisses don't reject it Do what you want quickly because the Doomsday on 2012
|
|
|
|
|
Well Spotted.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC League Table Link
CCC Link[ ^]
|
|
|
|
|
C#Coudou wrote: var price = 5,000
Write 5000 instead.
It may be counting 5,000 as a 5.000 while parsing, and giving you 5*2 = 10 as OUTPUT.
Regards,
Hiren.
"We owe a lot to the Indians, who taught us how to count, without which no worthwhile scientific discovery could have been made." - Einstein
Microsoft Dynamics CRM
|
|
|
|
|
the following will work fine for your current values...
var quantity = 2;
var price = 5000;
var total = quantity * price;
...not that you do not need to parse either value. If there is a requirement that price will use a decimal value (e.g. 5000.15) then you can do the following...
var quantity = 2;
var price 5000.15;
var total = price * quantity;
...again you will see there is no need for parsing. Notice I have but price before quantity in the second example - although either way will produce the correct result in javascript you may want to note that in other languages (such as C#) price needs to go before quantity in order to avoid a implicit cast to type int - but that's a different subject
Life goes very fast. Tomorrow, today is already yesterday.
modified on Thursday, December 2, 2010 6:29 AM
|
|
|
|
|
Hi,
I have a Imagebutton In a ContentplaceHolder Where I have to Adjust the height and width of the imagebutton with the scrren resolution. for that i had written a javascript..
========================================================
if ((screen.width>1024) && (screen.height>768))
{
var theImg = document.getElementById('Image1');
theImg.width = "100px";
theImg.height = "100px";
}
else
{
var Img = document.getElementById('ctl00_ContentPlaceHolder1_Image1');
Img.width = "50px";
Img.height = "50px";
}
===============================================
in the above code 'Image1' is the id of imagebutton.. im getting null value error when im using the above javascript.
i have also used 'ct100_contentplaceholder_Image1' and '<%image1.ClientID%>' But both of are not worked.
So Please suggest a solution for this problem.
thanks in advance,
vishnu
|
|
|
|
|
Definitely use the ClientID property, because the generated ID could change down the track.
Also, try:
if ((screen.width>1024) && (screen.height>768))
{
var theImg = document.getElementById('<%image1.ClientID%>');
theImg.style.width = "100px";
theImg.style.height = "100px";
}
else
{
var Img = document.getElementById('<%image1.ClientID%>');
Img.style.width = "50px";
Img.style.height = "50px";
}
I believe the width and height properties are a Unit or something similar - the width and height of the style will allow you to enter the CSS-like values (i.e. "100px").
Let me know how you go
P.S. Also check the source of the web page when you view it to ensure that '<%image1.ClientID%>' is actually being replaced with the ClientID.
|
|
|
|
|
Hi All,
I have 2 table with Primary and foreign key constrains.
where primary key is a identity column.
if I insert any value in primary table..child table foreign key value should be inserted automatically..
Is there any way of using it with out triggers? how to do the same for delete?
What is the traditional method...?
Sorry if this is a very basic question!!!
Ramkumar
("When you build bridges you can keep crossing them. ")
http://ramkumarishere.blogspot.com
|
|
|
|
|
You could create a stored procedure to create both the parent and child record, then standardize on that for creating parent records in your application.
Delete would be handled through a foreign key constraint with "cascade delete" option. This means that when the parent record is deleted, then all of the child records would be deleted.
|
|
|
|
|
Thanks for your time.
Do u have any sample stored Procedure or Article related to Insert(with pk as identity column).
goggled it..but could not find proper solution.
Ramkumar
("When you build bridges you can keep crossing them. ")
http://ramkumarishere.blogspot.com
|
|
|
|
|
Do you mean, like using SCOPE_IDENTITY()?
It stores the last inserted primary key value in the current context
DECLARE @Last_PK_Table1 AS INT
INSERT INTO Table1(field1, field2) VALUES ('Field1', 'Field2')
SET @Last_PK_Table1 = SCOPE_IDENTITY()
INSERT INTO Table2(Table1_PK, OtherField, OtherField2) VALUES (@Last_PK_Table1, 'field1', 'field testing')
thankx
|
|
|
|
|
I am using xtraGrid and trying to assign the ID using Eval but the result is showing as project.aspx?id=<%# ("website_project_id") %>
this is the code.. what's is my mistake?
<dxwgv:GridViewDataHyperLinkColumn Name="colProject" FieldName="website_project_name" Caption="Project" PropertiesHyperLinkEdit-NavigateUrlFormatString='project.aspx?id=<%# Eval("website_project_id") %>' />
|
|
|
|
|
You can't use eval inside a string like that. And beside that, it is a formatstring. The syntax for foramtstrings is to use numeric placeholders in curly brackets. Since you are using a specific vendor's control I would suggest using their knowledgebase and forums, but I you could start by investigating the fieldName and textField properties of the column.
|
|
|
|
|
hello,
I want insert student markes by aonce click using a gridview and this code:
private void Update()
{
string cmd = @"UPDATE EXAMEN set NOTE= CASE
WHEN CODE_MATIERE = '1' and @note1 =99 then '0'
when CODE_MATIERE = '1' and @note1 <>99 then @note1
WHEN CODE_MATIERE = '2' and @note2 ='99' then '0'
when CODE_MATIERE = '2' and @note2 <>99 then @note2 END, PRESENCE=
CASE WHEN CODE_MATIERE = '1' and @note1 =99 then 'TRUE'
when CODE_MATIERE = '2' and @note2 ='99' then 'TRUE' else 'FALSE'
end
WHERE NUM_INSCRIPTION = @num;";
float note1, note2;
string num;
SqlCommand myCommand;
SqlParameter param1, param2, param3;
using (SqlConnection myConnection = new SqlConnection(ConnectionString))
{
myConnection.Open();
foreach (GridViewRow row in GridView1.Rows)
{
note1 = float.Parse(((TextBox)row.FindControl("tmoy1")).Text);
note2 = float.Parse(((TextBox)row.FindControl("tmoy4")).Text);
num = ((Label)row.FindControl("lblUserID1")).Text;
myCommand = new SqlCommand(cmd, myConnection);
param1 = new SqlParameter("num", SqlDbType.VarChar, 4);
param1.Value = num;
myCommand.Parameters.Add(param1);
param2 = new SqlParameter("note1", SqlDbType.Float, 2);
param2.Value = note1;
myCommand.Parameters.Add(param2);
param3 = new SqlParameter("note2", SqlDbType.Float, 2);
param3.Value = note2;
myCommand.Parameters.Add(param3);
myCommand.ExecuteNonQuery();
}
} myConnection.Close();
}
but the code not work I tried the float and decimal and money for the type of note
I tried float.parse, Decimal.Parse, convert.todecimal
the code multiplies the values of the first row by 2 for each click on update button bizarre .
help me please,thanks
Écouter
Lire phonétiquement
|
|
|
|
|
Could you please tell which exact error you are getting, Because I have a doubt on your SQL query CASE statement.
Regards,
Hiren.
"We owe a lot to the Indians, who taught us how to count, without which no worthwhile scientific discovery could have been made." - Einstein
Microsoft Dynamics CRM
|
|
|
|