|
dharanighanta wrote: i am having 3 buttons.How to hide those buttons in html page?
I presume that you know all these 3 buttons name. When you are creating HTML find these names and replace it with blank value.
Still I didn't understand how you will save HTML file to client machine, I don't think that ASP.NET will be having write permission on client drives ?
|
|
|
|
|
Sorry,Html page'll save in local systems only.
I am calling the following javascript function on the save as html button click event
function saveashtml()
{
window.document.execCommand('SaveAs',false,'C:\\file.html');
}
This function simply reads the entire page and save it into html page.
|
|
|
|
|
After saving the file open it using javascript and remove these unwanted image tags. Check this[^] for opening files in javascript.
|
|
|
|
|
Hi,
I have a few controls in my page.
I have two drop downlist controls in which the second one is populated when a value is selcted in the first dropdownlist .
During this post back the tab index is lost .The tab is going to the first control.
Can some one help me with this so that i can get the tab index to the next one,
Thank you,
hepsi
|
|
|
|
|
You could use AJAX to get the values, and set the selected box using javascript. Or, you could set the selected item in the selected index changed event handler.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I want to retain the tab index ov post back .
I'm not using ajax...
Hepsi
|
|
|
|
|
hepsy.i wrote: I want to retain the tab index ov post back .
I'm not using ajax...
Set MaintainScrollPositionOnPostback="true" if you are using ASP.NET 2.0.
|
|
|
|
|
Thank you,
i'm not using 2.0, i'm using 1.0.
i dont want the scroll bar postion...
i need the tab index to go to the next dropdownlist but its going to the first control.
Thank you
hepsi
|
|
|
|
|
To reiterate my answer - if you don't want to use AJAX ( and it would be nice if you did ), then you should set the selected item in your code behind, in the event handler for the first drop down list changing, the one that fills the second drop down list. If there's no property on the server side, you could certainly inject client side code that runs when the page has loaded.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Why don't you just use a variable to store the information pointing to the control which has focus?
When page reloads just fetch the data from the viewstate.
|
|
|
|
|
hi frndz,
I am using MS.net 1.1
i am selecting 20 employees with address from database .I want to show this in Datagrid.Upto this ok.
but my need is I want to show first 5 emplyees with address in first row of the datagrid and next 5 five in 2 row..
like..
expect ur kind help...
thankx in advance..
All I ever wanted is what others have.... CrazySanker
|
|
|
|
|
You'd need to use a repeater for that, then you can write the code to build the table as you're hoping.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
thnak u
can u send any sample code's link ??
All I ever wanted is what others have.... CrazySanker
|
|
|
|
|
Hi,
i am using Form Authentication in my asp.net appication. It creates a persistent cookie named Cookie1 in cookies folder at my system. I want to change/set the Name of this cookie to Cookie2 on the click of a button from page.How can i do that ? (Q: Does form authentication always created persistent cookie, how can i change it so that when i close the browser , the coookie also goes off ?)
Alternatly, if i can create a new form authentication cookie at the same place with the name Cookie2. i am using following code.But cannot see my cookie2 in the folder
protected void LinkButton2_Click(object sender, EventArgs e)
{
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, "username", DateTime.Now, DateTime.Now.AddMinutes(30), true, FormsAuthentication.FormsCookiePath);
string encryptedTicket = FormsAuthentication.Encrypt(ticket);
HttpCookie authCookie = new HttpCookie("cookie2", encryptedTicket);
authCookie.Expires = System.DateTime.Now.AddMinutes(30);
authCookie.Secure = true;
Response.Cookies.Add(authCookie);
}
Any code support will be of great help.
Thx
|
|
|
|
|
i already post a message for u in Web Development forums
Hope it can help u
Regards,
Tomi
|
|
|
|
|
I have a dataView and a FormView that is connected to SQL Server. When someone clik on edit a record in the Dataview or insert new record in the Formview, I want the user to choose one of the choices that is in the dropdown list. So how can I add this dropdown list to the dataview and Formview. Also, the content of the dropdown list is suppose to be taken from a store data (from a table) in the database.
Thanks a lot for your help and I wish someone to help so that I could solve this problem...
|
|
|
|
|
Hi,
I have two listboxes, first listbox is populating the data from the database and then with the help of move button ,i am moving the selscted items from listbox 1 to listbox2 but, I am not able to find any property to he data in listbox2. I want to save them to a table "A_Software" to column "soft". I used the following code. But data it is getting stored is "System.Web.UI.WebControls.ListItemCollection"
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim str As String
str = "insert into a_software (soft)values('" & ListBox2.Items.ToString() & "')"
Dim comm As New SqlCommand(str, dbconn)
If dbconn.State <> ConnectionState.Open Then
dbconn.Open()
End If
Try
comm.ExecuteNonQuery()
Label1.ForeColor = Drawing.Color.Green
Label1.Text = "Success"
Catch ex As Exception
Label1.Text = ex.Message
End Try
End Sub
Chaitra N
|
|
|
|
|
Why is no-one capable of giving their variables sensible names ?
n_gchaitra wrote: ListBox2.Items.ToString()
Well, ListBox2.Items returns a listboxitemcollection. ToString on that, gives you the string you're getting. You need to iterate over the collection and build the SQL to insert the values. Of course, you're also wide open for SQL injection attacks.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
You need to iterate over the collection and build the SQL to insert the values. Of course, you're also wide open for SQL injection attacks.
Can u elaborate please?
Chaitra N
|
|
|
|
|
You are getting an error because the ListBox2.Items.ToString() function just returns the text System.Web.UI.WebControls.ListItemCollection - because that is what you are referencing....it's just a collection.
You would need to loop through each of the ListItems and get out the text value of each and run that as a seperate insert...i.e.
foreach(ListItem item in ListBox2.Items){
str = "insert into a_software (soft)values('" & item.Text & "')"
//then run the insert
}
that would be a way to do it using your current code, or build up a collection of inserts and run them all at once (not sure if you can do that with ExecuteNonQuery() though) - running everything at once would definitely be the better option.
|
|
|
|
|
I am using vb not c#. foreach(ListItem item in ListBox2.Items) will not work in vb
Chaitra N
|
|
|
|
|
|
Following is the code i have written, But it is giving the error, ExecuteNonQuery: CommandText property has not been initialized
Partial Class _Default
Inherits System.Web.UI.Page
Dim constr As String = ConfigurationSettings.AppSettings("conn")
Dim dbconn As New SqlConnection(constr)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Button1.Attributes.Add("onclick", "return fnMoveItems('ListBox1','ListBox2')")
Button2.Attributes.Add("onclick", "return fnMoveItems('ListBox2','ListBox1')")
End Sub
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim str As String
If dbconn.State <> ConnectionState.Open Then
dbconn.Open()
End If
For Each item As ListItem In ListBox2.Items
str = "insert into a_software (soft)values('" & item.Text & "')"
Next
Dim comm As New SqlCommand(str, dbconn)
Try
comm.ExecuteNonQuery()
Label1.ForeColor = Drawing.Color.Green
Label1.Text = "Success"
Catch ex As Exception
Label1.Text = ex.Message
End Try
End Sub
End Class
Chaitra N
|
|
|
|
|
Hi, This function is working, But the each value is getting stored in different row of the table. I want them to get stored in a single row.
Dim str As String
If dbconn.State <> ConnectionState.Open Then
dbconn.Open()
End If
For Each item As ListItem In lstselectedemployees.Items
str = "insert into a (soft)values('" & item.Text & "')"
Dim comm As New SqlCommand(str, dbconn)
Try
comm.ExecuteNonQuery()
Label1.ForeColor = Drawing.Color.Green
Label1.Text = "Success"
Catch ex As Exception
Label1.Text = ex.Message
End Try
Next
If I use the following code then, only the last item of the list box is getting stored,
Dim str As String
If dbconn.State <> ConnectionState.Open Then
dbconn.Open()
End If
For Each item As ListItem In lstselectedemployees.Items
str = "insert into a (soft)values('" & item.Text & "')"
next
Dim comm As New SqlCommand(str, dbconn)
Try
comm.ExecuteNonQuery()
Label1.ForeColor = Drawing.Color.Green
Label1.Text = "Success"
Catch ex As Exception
Label1.Text = ex.Message
End Try
Chaitra N
|
|
|
|
|
Hello Chaitra..
have a try with following code..
I think u have to save the all items of ListBox2 to database ...is i am correct???
if yes then,
dim szItem as new ListBoxItem
for each szItem in Listbox2.Items
//Now fire your insert query here
str = "insert into a_software (soft)values('" & szItem.text & "')"
Next
hope it will helps....
regards,
koolprasad2003
If the message is useful for U then please Rate This message...
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|