|
|
i have a web page and i need to export part of it into word docment,the part i need to export it somthing like datagrid but it is calnder control,i use this code
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment;filename=FileName.doc");
Response.ContentEncoding = System.Text.Encoding.UTF7;
Response.ContentType = "application/vnd.word";
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
this.CalnderControl.RenderControl(oHtmlTextWriter);
Response.Output.Write(oStringWriter.ToString());
Response.Flush();
Response.End();
my problem is how can i modify the properties of that output word docment,as example if i need the output of word docment to be in landscape mode
and the another problem the output of this control is appear fine in the browser it render as html tables with cells but when be exported into word ,there are alot of additional cells appear and the word docment make this cells appear ,however the html output contain the true styles but i think somthing like borders the word couldnot understand it
So Can any one know how to export part of webpage into word docment that i can set some proberties to the output word docment,and make it appear as it appear in the browser??
and what i notic that in the result of that docment that it appear without that addtional cells in the reading outline view but the another views appear with that addtional cells,
|
|
|
|
|
Hi, thanks for looking
Id like to signout a user when session ends
I was thinking of handling session_end on global.asax (Im using InProc)
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
FormsAuthentication.SignOut()
End Sub
But it doesnt work
How could i accomplish this?
Im using sessions to store some info
Sessions info is loaded when users sign in
And dependnig on session info i load data from DB on some pages
This pages are only available to logged in users
While testing, my session is expiring and when i access the private pages, data is not being shown because session variables are nothing (session has expired), but im still logged in since im being able to see this pages
Is it very common that sessions info is lost before session times out? (I mean, in a normal situation) Not modifying web.config
Thanks in advance
Alexei Rodriguez
modified on Tuesday, April 1, 2008 7:57 PM
|
|
|
|
|
actually you need to call a function that chks whether a user is logged in or not in every authenticated form (on every Page_load regardless of postback condition).
when a session expires the user is logged out, what you need to do is to chk that condition -- that session variables are null and if true redirect them to the login screen. you can call FormsAuthentication.SignOut() as necessary.
I hope that helps
Thanks
Rocky
Success is a ladder which you can't climb with your hands in your pockets.
|
|
|
|
|
Hi there,
i'm trying to accomplish the following (however searching the net for days now, without result):
As you know you have a asp button:
<asp:Button ID="test" Text="Test" OnClick="Test_Button_Click">
this will launch the method "Test_Button_Click" on the server side. As i find the built in OS buttons ugly, i designed some new buttons myself, and it uses a table of 3 columns wide, and 1 row high. in the middle is a transparent button, only showing the text. In the left and right there are some images as background with some roundings (to make a smooth nice looking button).
The probem now is that i want to do the following:
<uc1:UserButton ID="Test" Text="Test" OnClick="Test_Button_Click">
but i can't get the OnClick attribute to work for the usercontrol, tried few different things that i found on the internet, and eventually it leaded me to launch javascript. PLease can someone tell me how to integrate a OnClick attribute that executes server code when clicked, specifically the method specified, as a normal button does? Thanks in advance!
Kind Regards,
Nick
|
|
|
|
|
That is probably a large enough topic to require some studying on your part. I would start here[^]
led mike
|
|
|
|
|
Hi led mike,
thanks for the reply. I took a look at the google link you gave me. I guess what I need is a bigger push in the right direction.
in my humble logic it seemed simple, could i just pass the onclick attribute entered in the usercontrol to the button in my usercontrol?
Kind Regards,
Nick Verlinden
|
|
|
|
|
One possible problem you are running into is the click location is in one of your user controls constituent controls because the user control might not have any actual screen area that is not occupied by a constituent. If they are asp controls you should be able to capture the constituent control OnClick events.
However I still suggest you study the subject by digging into that first search result item and/or some of the others. It's always better to have a solid understanding of what you are about to use.
led mike
|
|
|
|
|
I need a little help with some code I'm working on. I have a Datalist control that is throwing the following expeption.
------------------------------------------------------------------------
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
------------------------------------------------------------------------
Here is my code.
<br />
Sub Edit_Command(ByVal sender As Object, ByVal e As DataListCommandEventArgs) Handles DataList.EditCommand<br />
<br />
DataList.EditItemIndex = CType(e.Item.ItemIndex, Integer)<br />
<br />
Dim strDate As String = ""<br />
Dim strAssignments As String = ""<br />
Dim strSchool As String = ""<br />
Dim strProgramme As String = ""<br />
Dim strSubject As String = ""<br />
Dim strCity As String = ""<br />
Dim strState As String = ""<br />
Dim strReason As String = ""<br />
<br />
Dim reader As SqlDataReader<br />
Dim cmd As New SqlCommand("SELECT * FROM tblVolDeclinedMissedCanceledAssignments WHERE VolunteerId=" & VolunteerId() & " AND Id=" & e.CommandArgument, cn)<br />
cmd.CommandType = Data.CommandType.Text<br />
<br />
Try<br />
cn.Open()<br />
reader = cmd.ExecuteReader()<br />
<br />
While reader.Read<br />
strDate = IIf(IsDBNull(reader("Date")), "", reader("Date"))<br />
strAssignments = IIf(IsDBNull(reader("Assignment")), "", reader("Assignment"))<br />
strSchool = IIf(IsDBNull(reader("SchoolVenue")), "", reader("SchoolVenue"))<br />
strProgramme = IIf(IsDBNull(reader("Programme")), "", reader("Programme"))<br />
strSubject = IIf(IsDBNull(reader("Subject")), "", reader("Subject"))<br />
strCity = IIf(IsDBNull(reader("City")), "", reader("City"))<br />
strState = IIf(IsDBNull(reader("StateProvince")), "", reader("StateProvince"))<br />
strReason = IIf(IsDBNull(reader("Reason")), "", reader("Reason"))<br />
End While<br />
<br />
Catch ex As Exception<br />
Throw New ApplicationException(ex.Message)<br />
Finally<br />
cn.Close()<br />
End Try<br />
<br />
CType(e.Item.FindControl("rdpEditDate"), Telerik.WebControls.RadDatePicker).SelectedDate = strDate<br />
CType(e.Item.FindControl("ddlEditAssignments"), DropDownList).SelectedValue = strAssignments<br />
CType(e.Item.FindControl("txtEditSchoolVenue"), TextBox).Text = strSchool<br />
CType(e.Item.FindControl("ddlEditProgramme"), DropDownList).SelectedValue = strProgramme<br />
CType(e.Item.FindControl("ddlEditSubject"), DropDownList).SelectedValue = strSubject<br />
CType(e.Item.FindControl("txtEditCity"), TextBox).Text = strCity<br />
CType(e.Item.FindControl("ddlEditStateProvince"), DropDownList).SelectedValue = strState<br />
CType(e.Item.FindControl("txtEditReason"), TextBox).Text = strReason<br />
'Me.ddlEditAssignments.Items.FindByText(reader("Assignment")).Selected = True<br />
<br />
LoadDataMSCAData()<br />
End Sub<br />
The exception is thrown as soon as I hit the lines at the bottom where I am trying to assign the values from the datareader to the controls in the EditItemTemplate of the Datalist. What is really wierd about this is that I am using the exact same syntax to find the controls in my update command (below), and it works just fine.
Update Command:
<br />
Protected Sub DataList_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles DataList.UpdateCommand<br />
<br />
Dim arg As String = e.CommandArgument<br />
<br />
Dim strDate As String = CType(e.Item.FindControl("rdpEditDate"), Telerik.WebControls.RadDatePicker).SelectedDate.ToString<br />
Dim strAssignment As String = CType(e.Item.FindControl("ddlEditAssignments"), DropDownList).SelectedValue<br />
Dim strSchoolVenue As String = CType(e.Item.FindControl("txtEditSchoolVenue"), TextBox).Text<br />
Dim strProgramme As String = CType(e.Item.FindControl("ddlEditProgramme"), DropDownList).SelectedValue<br />
Dim strSubject As String = CType(e.Item.FindControl("ddlEditSubject"), DropDownList).SelectedValue<br />
Dim strCity As String = CType(e.Item.FindControl("txtEditCity"), TextBox).Text<br />
Dim strStateProvince As String = CType(e.Item.FindControl("ddlEditStateProvince"), DropDownList).SelectedValue<br />
Dim strReason As String = CType(e.Item.FindControl("txtEditReason"), TextBox).Text<br />
<br />
Dim sql As String<br />
<br />
Try<br />
sql = "UPDATE tblVolDeclinedMissedCanceledAssignments " & _<br />
"SET Date=@Date, Assignment=@Assignment, SchoolVenue=@SchoolVenue, Programme=@Programme, Subject=@Subject, City=@City, StateProvince=@StateProvince, Reason=@Reason " & _<br />
"WHERE VolunteerId=" & Me.VolunteerId & " AND Id=" & e.CommandArgument<br />
<br />
Dim cmd As New SqlCommand(sql, cn)<br />
cmd.Parameters.AddWithValue("@Date", strDate)<br />
cmd.Parameters.AddWithValue("@Assignment", strAssignment)<br />
cmd.Parameters.AddWithValue("@SchoolVenue", strSchoolVenue)<br />
cmd.Parameters.AddWithValue("@Programme", strProgramme)<br />
cmd.Parameters.AddWithValue("@Subject", strSubject)<br />
cmd.Parameters.AddWithValue("@City", strCity)<br />
cmd.Parameters.AddWithValue("@StateProvince", strStateProvince)<br />
cmd.Parameters.AddWithValue("@Reason", strReason)<br />
cn.Open()<br />
<br />
cmd.ExecuteNonQuery()<br />
<br />
Catch ex As Exception<br />
Throw New Exception<br />
Finally<br />
cn.Close()<br />
End Try<br />
<br />
DataList.EditItemIndex = -1<br />
LoadDataMSCAData()<br />
<br />
End Sub<br />
I have allreay read a bunch of forums and articals and can't figure out what I missing. If anyone here could tell me what I'm missing that would be great.
Thanks,
-Adam N. Thompson
|
|
|
|
|
I have my application migrated to VS2005 from VS2003, and the database is on MS SQL 2005.
I have couple of pages that have dynamic datagrids. When I run the application from within VS, it runs faster, loads the dynamic grid page faster than it does when I run outside of VS environment.
What causes it to run slower, outside the VS environment? How can I improve performance?
Thank You
Hashok
|
|
|
|
|
|
It's an entry page .. like Emp..
when I go to run .. there's some Textbox fields defined with a yellow back color ....
how can I prevent that ..
jooooo
|
|
|
|
|
kindman_nb wrote: It's an entry page .. like Emp..
when I go to run .. there's some Textbox fields defined with a yellow back color ....
Do you have the Google toolbar installed with the AutoFill feature switched on?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
|
Hi,
I need a Prompt With Password Type.
var x = prompt("Enter in the password"," ")
This code proompt and ask for a password but it will apperar as text , but i want it as a password.
Is it possible ?
<br />
if(yes)<br />
how ?<br />
else<br />
Any Idea !!
Thanks in advance !!!
Best Regards
-----------------
Abhijit Jana
Microsoft Certified Professional
"Success is Journey it's not a destination"
|
|
|
|
|
You would have to develop a custom page with the appearance of a dialog box. Then you could use an INPUT tag of type 'password' to collect the user's password.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hey!
Thanks for the previous reply!
I have created a web scheduling system which will be used internally(intranet). Now, I am trying to sync the outlook calendar of the user and the web application. For example, if the user uses the web application to create a new appointment or edits the appointment, the web application is supposed to send an update to the outlook calendar. I am using the active directory credentials to get users to log in to my application.
My question is, how should I approach this problem. I have got no idea on how to get started . Hope some of you can give me suggestions on how to get started.
Thanks in advance!!!
|
|
|
|
|
Are you working with Exchange Server Also??
Best Regards
-----------------
Abhijit Jana
Microsoft Certified Professional
"Success is Journey it's not a destination"
|
|
|
|
|
I am not directly working with exchange server. If I have to work with the exchange server, it would take some time to get permissions.
So looking for alternatives.
Thanks
|
|
|
|
|
Hi
I have the following to urls, one is in asp hyperlink the other just a normal hyperlink, whwne I use the asp one it says "The server tag is not well formed"
When I use the normal a href it works, why would this be?
thanks!
<asp:HyperLink NavigateUrl="Page.aspx?qtynewvar=<%# Eval("Value") %>&stringname=<%# Eval("Value") %>&stringname=<%# Eval("Value")%>" Text="<%# Eval("Value") %>" runat="server">
</asp:HyperLink>
<a href="Page.aspx?qtynewvar=<%# Eval("Value") %>&stringname=<%# Eval("Value") %>&stringname=<%# Eval("Value")%>" Text="<%# Eval("Value") %>"><%# Eval("Qty_New") %></a>
</ItemTemplate>
|
|
|
|
|
Still having problems using Google[^] I see. Who ever told you that you don't need to learn how to research information to develop software was wrong, don't listen to them.
led mike
|
|
|
|
|
Still an obnoxious programmer I see, don't worry one day you will get a life
in regards to your google quip I thought because this forum is designed for programmers to help each other I might be able to get an answer. I have tried google but can't find the apporpraite solution.
|
|
|
|
|
.netman wrote: Still an obnoxious programmer
At least I can do my job. Just in case you are interested I provided you a link that will help you learn what your error message means. That should in turn help you solve your problem yes?
led mike
|
|
|
|
|
OK the link was useless, I know what well formed means I just wondered if anyone knew the correct syntax to put variables into the hyperlink field .
You may have seen that I have posted help to other so I expected someone to maybe help me, that is why I posted on this forum.
|
|
|
|
|
I don't use inline server code like that, I think it's garbage. I would use code behind to generate the URL string and assign the value to the controls property.
Anyway, this might help you.[^]
led mike
|
|
|
|
|