|
you can use the same javascript - bind it dynamically in the code-behind using the Page.RegisterStartupScript
- Regards - JON Life is not measured by the amount of breaths we take, but by the moments that take our breath away.
|
|
|
|
|
Thanks John,
I have done the same and working fine. But the problem is this will execute after going to the clients browser, then come back again to the server to redirect to the target page.
I want to avoid this round trip.
|
|
|
|
|
Anurag Gandhi wrote: then come back again to the server to redirect to the target page.
It has to come back to the server to redirect. What John is saying is when you render your page, call RegisterStartUpScript and register a javascript function. The javascript function will then redirect the browser to a new page. The browser will go to the server to get the new page. It won't go to the server to do anything with the current page. There are no extra round trips here.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
I have a problem that when i try to send email with attachment its not working and thats because i need to upload the file to the server and that is action and sending email is another action.
so thats not working in the same page.
Waseem Kanafani
|
|
|
|
|
But sending the email is a server-side action which you can take after uploading the attachment
Upload file
save to server
create email
attach saved file
send
- what is your problem?
Fred
|
|
|
|
|
Yes your are right just i have problem with that, that am an begginer in asp and i need to learn fast.
Thank you
|
|
|
|
|
Waseem_Kanafani wrote: i need to learn fast
Google is faster than you, so as fast as you want to learn, google will give you the answers as quick as you need them.
This is pretty basic stuff and you've just been given the pseudo code to do this. You must have some code server side to save the file from the upload control. As soon as it is saved, create an instance of your message sending class, create a mail, attach the file and send. All done in one go on the server.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
Hi guys.Im looking to update my database from my datagrid.
When u click on edit, it gives you an option to update or cancel action, so I need to update the database after making the change.Prolem with this code is that it work for txt boxes not datagrid, but it shudnt be that different.
My previous code is like this, so Im hoping sumone will assist me in doing so.
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
If IsNumeric(txtFirstName.Text) Then
MsgBox("Please type your name in letters", MsgBoxStyle.Critical, "KNS System-Error")
Exit Sub
End If
If IsNumeric(txtCity.Text) Then
MsgBox("Please type your City in letters", MsgBoxStyle.Critical, "KNS System-Error")
Exit Sub
End If
If Not IsNumeric(txtPostalCode.Text) Then
MsgBox("Please type your PostalCode in numbers", MsgBoxStyle.Critical, "KNS-System-Error")
Exit Sub
End If
If Not IsNumeric(txtCelnumber.Text) Then
MsgBox("Please type your Cellphonenumber in numbers", MsgBoxStyle.Critical, "KNS-System-Error")
Exit Sub
End If
da = New OleDbDataAdapter("Select * From Employees", cn)
cb = New OleDbCommandBuilder(da)
ds = New DataSet
ds.Clear()
da.Fill(ds, "Employees")
dt = New DataTable
dt = ds.Tables("Employees")
Dim dr() As DataRow
dr = dt.Select("EmpID = " & txtEmpID.Text & "")
dr(0).BeginEdit()
'dr(0)("Client_ID") = txtClientID.Text
dr(0)("EFirstName") = txtFirstName.Text
dr(0)("ESurname") = txtSurname.Text
dr(0)("EDepartment") = cboDept.SelectedItem
dr(0)("EPassword") = txtPassword.Text
dr(0)("EConfirmPassword") = txtConfirm.Text
dr(0)("EPhonenumber") = mtxtPhoneNumber.Text
dr(0)("ECelnumber") = txtCelnumber.Text
dr(0)("EAddress") = txtAddress.Text
dr(0)("ECity") = txtCity.Text
dr(0)("EPostalcode") = txtPostalCode.Text
dr(0).EndEdit()
da.Update(ds, "Employees")
MsgBox("Record Edited Successfully")
Disabling()
End Sub
Problem is that this I did with text boxes.What Im looking for is updating directly from the datagrid.Thanx in advance
kagiso
|
|
|
|
|
Guys, I found something but still I get errors.
Code.
Protected Sub GridView1_RowUpdated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdatedEventArgs) Handles GridView1.RowUpdated
Dim cm As New OleDbCommand
Dim con As New OleDbConnection
Dim str1 As String = "Provider = Microsoft.Jet.oledb.4.0; Data source =C:\Documents and Settings\Kagisho.Mashiloane.ALFRGIS\My Documents\Visual Studio 2005\Projects\Search AL\TelephoneList.mdb"
Dim str2 As String
con = New OleDbConnection(str1)
con.Open()
str2 = "select * From Extensions"
cm = New OleDbCommand(str2, con)
Dim updateSQL As String = "UPDATE Extension SET Name = @Name, " & "Surname = @Surname, " & "Xtension = @Xtension"
cm.Parameters.Clear()
cm.Parameters.Add("@Name", Name)
cm.Parameters.Add("@Surname", Surname)
cm.Parameters.Add("@Xtension", Xtension)
cm.ExecuteNonQuery()
'Next
lblUpdatemessage.Text = "Update Successfull"
kagiso
|
|
|
|
|
I am getting "Server Application Unavailable" error when trying to browse the Web application.
Can any one tell me how to solve this Error?
and in the event log
Failed to initialize the AppDomain:/LM/W3SVC/1/ROOT/DataEditor
Exception: System.IO.FileLoadException
Message: Could not load file or assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Access is denied.
StackTrace: at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(String assemblyName, String typeName)
at System.AppDomain.CreateInstance(String assemblyName, String typeName)
at System.AppDomain.CreateInstance(String assemblyName, String typeName)
at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironmentAndReportErrors(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
-- modified at 5:53 Monday 19th November, 2007
|
|
|
|
|
Reddy Prakash wrote: I am getting "Server Application Unavailable"
Goto your Event viewer to find out where is the problem
|
|
|
|
|
Reinstall your Framework, then IIS. It will solve your problem
|
|
|
|
|
Abhijit Jana wrote: Reinstall your Framework, then IIS
Too long run. Will it be better to find the reason which caused the problem before doing such things ?
|
|
|
|
|
yes, it is long prcedure...but it will solve the problem, cause i have face the same problem that he raised.
|
|
|
|
|
You need to check if the ASP.NET 2.0 framework is installed on the machine you are trying to run the application....
|
|
|
|
|
|
I want to display columns dynamically(based on dates selected in dropdown).
I selected 15/11/2007 AND 17/11/2007. it displays only those 3days..
FromDate: 15/11/2007(selected from dropdown) toDate:17/11/2007(selected from Dropdown)
when I click on button it shoul display in gridview like..
-------------------------------------------------------
productId Name 15/11/2007 16/11/2007 17/11/2007
------------------------------------------------------
1 aaaa sucess fail success
2 bbbb fail fail success
--------------------------------------------------------
If I select in the range from 15/11/16 to 16/11/2007 it should display only 2 days columns).
----------------------------------------
productId Name 15/11/2007 16/11/2007
-------------------------------------------
1 aaaa sucess fail
2 bbbb fail fail
--------------------------------------------
can any one give me solution? am using asp.net 2.0 and c#
|
|
|
|
|
Hi,
I will tell u how to do this on datagrid. The same thing u can implement on gridview. set property AutogenerateColumns="true". Based up on the drop down selection return a dataset from backend and directly bind it to the datagrid.
Ur dataset may contain 4 columns i.e.,
ProductId Name 15/11/2007 16/11/2007 17/11/2007
or 3 columns i.e.,
ProductId Name 15/11/2007 16/11/2007 Based on ur selection.
Hope my solution will give u what u wanted.
Raj
|
|
|
|
|
Hi,
On button click call function to bindgrid in that u can add columns.
BoundField bfield = new BoundField();
bfield.DataField = "empno";<br />
bfield.HeaderText = "Emp No";<br />
GridView1.Columns.Add(bfield);<br />
GridView1.DataSource= MyDataTable;<br />
GridView1.DataBind();<br />
Thanks,
Sun Rays
Rate this post if you like answer.
My Articles
|
|
|
|
|
Hi friends
I need to send the user billing address details to google checkout page.
if any one has some article or links plz forward me.
thanks
please don't forget to vote on the post that helped you.
|
|
|
|
|
Hi,
I am having my .net application in C drive. I have a image control on my .aspx page. At run time I want to bind a image to this image control from D drive which is out application context. Please give me some tips to achieve this.
Thanks in advance.
Raj
|
|
|
|
|
You can't, an ASP.NET app cannot look above it's root. Move the file
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 Graus,
Using FileStream class i will establish a file stream to that file. Later i will declare a Byte[] datatype. then using binaryreader(filestream object,Byte[]) i will convert the image file and then i will show this to my image control. It has worked. But this solution is time consuming. Most of my users access my application thru dial up connection.To display 9000 photos it will take so much of time.
I am searching for a better solution. Please if u find one other than the above let me know
Thank u in advance,
Raj
|
|
|
|
|
raj@code wrote: Using FileStream class i will establish a file stream to that file.
I don't think that ASP.NET can access the file which is stored outside the domain.
|
|
|
|
|
Use the Absolute Image path to display the Image. I would suggest you to store the Absolute path in a common place like web.config or resource file and access it from there.
- Regards - JON Life is not measured by the amount of breaths we take, but by the moments that take our breath away.
|
|
|
|