|
Sonia Gupta wrote: how should i get that data in the source file.
Declare a public variable in you code behind, and set the values to be passed in this variable. Use the variable in scriptlets in javascript like
var JSVariable = <% =PublicServerVariable > . You can redirect to the URL with this value
|
|
|
|
|
Thank You Navaneeth
Soniagupta1@yahoo.co.in
Yahoo Messenger Id = soniagupta1
|
|
|
|
|
i am designing an application in ASP.Net using C# in Visual studio2005. while making crystal reports, my requirement is that when user enter any value(e.g, year) in the textBox and click the button the values according to user requiredment are displayed in report. but to load report i am writing code in "crystalReportViewer1_Load" and in query i want to use the value of textBox which is present on previous page.
i have write the code as:
public static string s1 = textBox1.Text;
public static string s2 = textBox1.Text;
and in "crystalReportViewer1_Load" i hav write
string s3 = rescue15.reports.s1;
string s4 = rescue15.reports.s2;
but the following error comes
Error 7 An object reference is required for the nonstatic field, method, or property 'rescue15.reports.textBox1'
can anyone guide me plz
|
|
|
|
|
Hi mavii
what if like this?
session("s1") = textBox1.Text;
session("s2") = textBox1.Text;
and in "crystalReportViewer1_Load"
string s3 = session("s1");
string s4 = session("s2");
Is it solving the problem? (I am a new with CR also).
Regards,
Riza Azmi
Simple thing should be simple, complex thing should be possible
|
|
|
|
|
can u plz explain about how u have used session, i mean if i simply write like this,
session("s1") = textBox1.Text;
session("s2") = textBox1.Text;
the following errors come:
Error 1: Class, struct, or interface method must have a return type
Error 2 Type expected
Error 3 Invalid token ';' in class, struct, or interface member declaration
|
|
|
|
|
You can't, because the other page just doesn't exist anymore. You can do one of several things -
1 - store the value in the session ( as someone showed you )
2 - put the value on the URL when you navigate to the second page ( the advantage of this is that your new page becomes bookmarkable )
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
can u plz explain your following sugesstion, i am not exactly getting what to do
" put the value on the URL when you navigate to the second page ( the advantage of this is that your new page becomes bookmarkable )"
|
|
|
|
|
If you had a list of songs, for example, and you were going to a page that printed the lyrics, then if each song had an Id, each song title could be rendered as a link, but the links could be
lyrics.aspx?songId=1
lyrics.aspx?songId=2
lyrics.aspx?songId=3
and so on. Then lyrics.aspx could read the songId from the query string and use it in a SQL query to retrieve the correct lyrics and render them.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
mavii wrote: put the value on the URL when you navigate to the second page ( the advantage of this is that your new page becomes bookmarkable
He meant pass the values through URL as query string. So your URL will look like yourpage.aspx?TextBox1Value=somevalue&TextBox2Value=somevalue . This can be taken in the page using Request.QueryString["TextBox1Value"] . And these type of URL's are bookmarkable, ie if you add this to bookmarks, it can be reloaded after some time. But if you use session and bookmarked the page, you can't reload it because session will be timed out.
|
|
|
|
|
Using query string is not safe regarding to security, whereas using session you can pass the value withouth user "see" it.
Regards,
Riza Azmi
Simple thing should be simple, complex thing should be possible
|
|
|
|
|
Riza Azmi wrote: Using query string is not safe regarding to security,
Choosing the method is always depends on the requirement. If security is not a main concern, query strings are the best, and in that case usage of sessions are not advised. Moreover as Christian told, the page will be book markable. But if security is the main concern, still you can use query string but after encrypting the value.
I always prefer query strings, since it won't keep anything in the server memory as session does.
|
|
|
|
|
session is hide the data. that is what I called "secure". no matter encrypted or no, user still cannot deal with the value directly.
session can store any datatype including datasource.
thanks for sharing
Regards,
Riza Azmi
Simple thing should be simple, complex thing should be possible
|
|
|
|
|
Tamper the Querystring Parameters. It's safe. Session Objects should be used only when you need a value through out the session accross the pages. When it's just a input parameter to generate a report which is not going to be the same every time you fetch the data then Query string is the best way here.
Regards - J O H N -
|
|
|
|
|
Hello friends,
Here is another error which I am getting in asp.net
My task is to change the color of an image in grayscale or sepia and after that save that image to the server.
I have completed the half part of that task but in the remaining half i am getting an error.
The error is "System.ArgumentException: Invalid parameter used."
Now let me explain what i am doing is Using bitmap for changing image color and after that saving that bitmap on server at that point i am getting this error...
i am writing some of that code here:::
Public Function ConvertToGrayscale(ByVal source As Bitmap) As Bitmap
Dim bm As New Bitmap(source.Width, source.Height)
Dim x
Dim y
For y = 0 To bm.Height - 1
For x = 0 To bm.Width - 1
Dim c As Color = source.GetPixel(x, y)
Dim luma As Integer = CInt(c.R * 0.3 + c.G * 0.59 + c.B * 0.11)
bm.SetPixel(x, y, Color.FromArgb(luma, luma, luma))
Next
Next
Return bm
End Function
Public Function ConvertToSepia(ByVal source As Bitmap) As Bitmap
Dim bm As New Bitmap(source.Width, source.Height)
Dim R, G, B As Integer
Dim x
Dim y
For y = 0 To bm.Height - 1
For x = 0 To bm.Width - 1
Dim c As Color = source.GetPixel(x, y)
R = CInt(c.R * 0.393 + c.G * 0.769 + c.B * 0.189)
If R > 255 Then R = 255
G = CInt(c.R * 0.349 + c.G * 0.686 + c.B * 0.168)
If G > 255 Then G = 255
B = CInt(c.R * 0.272 + c.G * 0.534 + c.B * 0.131)
If B > 255 Then B = 255
bm.SetPixel(x, y, Color.FromArgb(R, G, B))
Next
Next
Return bm
End Function
Private Function uploadFile(ByVal oFile As System.Web.UI.HtmlControls.HtmlInputFile, ByVal cbochoose As DropDownList, ByVal txtITitle As TextBox, ByVal ControlNo As Long, ByVal CoverType As String)
Dim obm As Bitmap, obm1 As Bitmap, obm2 As Bitmap
obm = New Bitmap(oFile.Value)
obm1 = ConvertToGrayscale(obm)
obm1.Save(strFilePath & strFName_B)
obm2 = ConvertToSepia(obm)
obm2.Save(strFilePath & strFName_S)
obm.Dispose() : obm1.Dispose() : obm2.Dispose()
oFile.PostedFile.SaveAs(strFilePath & strFName & strFExt)
End Function
I don't know exactly where i am getting error... at which step...
Now tell me what will be the reason of getting that error.......
I am waiting for your reply....
please try it first and after that give the answer.
Thanks in advance................
|
|
|
|
|
Read my image processing articles, this is the worst way you could create greyscale/sepia images.
Which line blows up ? Did you go through the debugger to check, for example, if the paths you're generating are valid ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi christian,
I have solved out this problem thanks for your reply i got the answer from their.
really appreciating your way of reply.
i understand what my mistake is.
thanks for your reply.
|
|
|
|
|
hi,
my web application is able open excel template on my system(server),
when i run this application on client machine(another system)
every thing works fine but excel template is not opening
can anybody knows wht i have to,
thanks
Afreen
|
|
|
|
|
Is EXCEL installed on the client machine?
Regards - J O H N -
|
|
|
|
|
|
iam having a textbox in that i write some text and press enter then a function should execute .
|
|
|
|
|
You can use AJAX to execute a server side function
|
|
|
|
|
hi navaneeth how ru ... this is id by writting the code in server button click .and i called the button click in javascript like this
var obj
obj=document.getElementById("btngetdata");
obj.click();
still its not getting is any other with out using ajax
|
|
|
|
|
I have created one library which will help to call button event when enter key is pressed. Check this[^] and download the library
|
|
|
|
|
DefaultButton.SetDefaultButton ( control , btButton )
where i should write this one
|
|
|
|
|
You can write in page load.
|
|
|
|