|
Thanks for looking at this for me!
jkirkerx wrote: You can program events
SelectAction = TreeNodeSelectAction.Expand
I'm not sure I follow here. There isn't necessarily an expansion going on. Or does this event fire at other times?
jkirkerx wrote: I don't understand that, you want to clear the tree view, or change the selected node?
Neither. The tree is to hold information about users, groups and other setup information. If I select a user, then the User Control to view / edit user information is loaded into the right hand pane. At the bottom of the control, I have an OK button and a Cancel button. When I click OK, then I want the back-end database updating (I can do that) but I want the user Node in the tree to remain selected and the User Control to remain visible (due to the user node being selected.)
|
|
|
|
|
You can the select action of the node group to 4 choices - Just FYI
TreeNodeSelectAction.Expand -
TreeNodeSelectAction.None
TreeNodeSelectAction.Select - Selecting a node
TreeNodeSelectAction.SelectExpand - I guess expanding a folder
Controls that are made in onInit or PreInit are persistent. They will remain after a postback trip to the server.
Controls that are made after Init, like on Page.Load are not persistent, and will not survive a postback. Even if you load the control again after postback, the data in the textbox will be lost, because it's a new version of the control.
So either you redesign your form, to load the control in Init, so the control stays, or you have to do something else.
I would probably load all the controls, and turn off the visibility. Then on node select, turn on the visibility of the control you need.
You can also use CSS, in which you just toggle the "display" to inline-block or none.
I not sure how you wrote the code, if your using webform, then place all the controls on the form.
If your using code behind to generate the page, then use PreInit, or I think you can override an event using
Protected Overrides Sub OnInit(ByVal e as System.EventArgs)
'Load your user controls here.
End Sub
Keep in mind, that all controls or HTML markup has to be made in OnInit to persist. You use Page.Load just to populate the data in the HTML markup.
|
|
|
|
|
Thank you for all the help!
Turns out that it was a Noob mistake. I hadn't wrapped my head around ViewState and so on. Managed to get it working now
|
|
|
|
|
I need to POST a set of XML data to a web device. I'm most familiar with ASPX / c#. Basically the user lands on my page and I retrieve two parameters from the URL and store them as Session Variables (like this):
<script runat="server">
Sub Page_Load()
dim MA as String
MA = Request.QueryString("MA")
Session.Add("MAC_ADDRESS", MA)
Message.Text = Session("MAC_ADDRESS")
End Sub
</script>
I realize the above is currently VB, but I'm going to switch this to c# (as I'm more familiar with it). I need to use these session variables to POST XML formatted data to a URL:
POST TO: ([IP_Address]/command.xml)
Example XML:
<?xml version="1.0" ?>
<!DOCTYPE ABC "UserAdd.dtd">
<ABC COMMAND="USER_ADD" MAC_ADDR="Session("MAC_ADDRESS")>
<EXPIRY_TIME UNITS="SECONDS">60</EXPIRY_TIME>
</ABC>
Once the Device receives the command, it sends back a response (OK or Error), I also need to retrieve and verify the response (just a Response.Write to screen would be fine). I've never done anything like this before so any help is greatly appreciated!
Thanks!
Brad
EDIT:
Here is a Javascript version that WORKS. This is based on a form where the user fills out the fields that makeup the XML (I'm only using MAC_ADDRESS right now, none of the others). If Someone Could help me translate whats happening here to c# in a simpler way, I would be MOST appreciative!
function SendXML()
{
var usg = template.XMLDocument
clearResults();
usg.async = false;
usg.preserveWhiteSpace = false;
BuildEls(usg);
document.all("xmlCommand").insertAdjacentText("BeforeEnd",
usg.xml);
var httpOb = new ActiveXObject("Microsoft.XMLHTTP");
httpOb.Open("POST", usgAddr, false);
httpOb.send(usg);
document.all("xmlResponse").insertAdjacentText("BeforeEnd",
httpOb.responseXML.xml);
}
modified 5-Sep-14 15:06pm.
|
|
|
|
|
Gridview with Textbox Control how to pass JQuery Scrpt
using Asp.net With C#
|
|
|
|
|
I don't understand what you are asking.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I have a word document that needs to be converted to HTML page. Basically, the doc is the study material for Economics. So there will be Page Content Listing, Chapter Headings, Subheadings, small captions, titles , images, etc. Some texts need to be bold, some to be italic, and some other needs to be underlined. I need to apply proper styles for these contents.
I can convert the document to html page using the code mentioned in this link. But I am not sure how to apply the required styles? Should I use XSLT or simple CSS to convert this html page to formatted one?
|
|
|
|
|
You should use VSTO. Open the document with it and save as HTML...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
We are using the code below to pass an user password to a MVC web service encoding its value. The problem that when we run a HP fortify web scan on the application we are getting "password management heap inspection fortify" issues with passing the password to the web service. The finding has to do with not clearing out the password. Can anyone provide any advise?
string username = collection["username"].ToString();
string password = collection["password"].ToString();
/////LOGIN USER
string passurl = System.Web.HttpUtility.UrlEncode(Password);
response = client.GetAsync("Registration?username=" + Username + "&password=" + passurl + "&edi=" + "" + "&isEdi=" + false).Result;
responseBodyAsText = response.Content.ReadAsStringAsync().Result;
statuses = JObject.Parse(responseBodyAsText);
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(UserCred));
using (var ms = new MemoryStream(Encoding.Unicode.GetBytes(statuses.ToString())))
{
usercred = (UserCred)serializer.ReadObject(ms);
}
Session["userData"] = usercred;
Session.Add("Authenticated", "True");
return RedirectToAction("Index", "Home", usercred);
modified 3-Sep-14 14:33pm.
|
|
|
|
|
//string FileName = "";
string _fileName = FileName.Replace("?",@"\");
string fileType = Path.GetExtension(_fileName);
FileStream str = File.OpenRead(_fileName);
System.IO.BinaryReader r = new System.IO.BinaryReader(str);
string fileclass = "";
byte buffer;
str.Seek(0, SeekOrigin.Begin);
buffer = r.ReadByte();
fileclass = buffer.ToString();
buffer = r.ReadByte();
fileclass += buffer.ToString();
r.Close();
return Convert.ToString(SR_BAL_Common.MatchFileType(fileType.ToUpper(), fileclass.ToString()));
Ajax Method
$.ajax({
type: "POST",
url: _URL,
data: '{"FileName":"' + replaceableString + '"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
beforeSend: function () { },
complete: function () { },
error: function (xhr, desc, exceptionobj) { alert(xhr.responseText); },
success: function (Result, Status) {
alert(Result.d);
if (Result.d == "0") {
alert("Please select valid CV to upload. \nOnly .pdf, .doc, .docx, .html, .htm, .txt and .rtf files are allowed.");
return false;
}
}
});
The above code is working on Local but on server it giving error 500 will please suggest any why this error is coming.
Pawan Jha
|
|
|
|
|
You're passing the path of a file on the client to the server, and then trying to open that file on the server.
It works when you're running it locally, because the client and server are the same machine. When you deploy to a real server, the client and server are different machines, and the server has no access to the client's file system.
You need to post the contents of the file to the server, and process the posted contents. Since you're using an AJAX request, you'll need to use the FormData object:
NB: This is not supported[^] in IE9 or earlier.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
|
I trying get ssrs 2008 up and running on a new server.
I got everything to work just like it dit on my old server and I can deploy reports and view them in the report manager, but I cannot seem to view a report from asp.net applications either in a reportviewer or using the reportexecutionservice. I keep getting the error: The request failed with HTTP status 401: Unauthorized
This is the first time that I had to set up ssrs so I do not know whether I have missed something. I tried to make everything the same as the instance on my old server.
Any assistance would be appreciated.
The following code is what I use for the web execution service and it used to work fine.
This code basically just renders the report as a pdf and downloads it.
rs.Credentials = New System.Net.NetworkCredential("username", "password", "domainname")
Dim reportPath As String = "/OLS/" & ReportName
Dim ResultStream() As Byte
Dim StreamIdentifiers() As String = Nothing
Dim optionalParams(1) As ParameterValue
Dim OptionalParam As String = Nothing
Dim optionalWarnings As WebReference.Warning() = Nothing
optionalParams(0) = New WebReference.ParameterValue
optionalParams(0).Name = "WarningID"
optionalParams(0).Value = Session("ID")
' Create and set the content type string
Dim contentType As String = "application/pdf"
Dim historyID As String = Nothing
Dim devInfo As String = "<deviceinfo><toolbar>False"
Dim format As String = "PDF"
Dim extension As String = ""
Dim encoding As String = ""
Dim mimeType As String = ""
Dim warnings As Warning() = Nothing
Dim streamIDs As String() = Nothing
Dim WarningID As String
WarningID = Session("ID")
Dim execInfo As New ExecutionInfo
Dim execHeader As New ExecutionHeader()
rs.ExecutionHeaderValue = execHeader
execInfo = rs.LoadReport(reportPath, historyID)
rs.SetExecutionParameters(optionalParams, "en-us")
Dim FilePath As String
FilePath = "c:\WebDocuments\OLS\TempDocs\" & Session("EmployeeID") & "\"
Try
ResultStream = rs.Render(format, devInfo, extension, encoding, mimeType, warnings, streamIDs)
execInfo = rs.GetExecutionInfo()
Console.WriteLine("Execution date and time: {0}", execInfo.ExecutionDateTime)
Catch err As SoapException
'Console.WriteLine(e.Detail.OuterXml)
End Try
' Write the contents of the report to an MHTML file.
Try
Dim stream As FileStream = File.Create(FilePath + WarningID + ".pdf", ResultStream.Length)
Console.WriteLine("File created.")
stream.Write(ResultStream, 0, ResultStream.Length)
Console.WriteLine("Result written to the file.")
stream.Close()
Catch err As Exception
Console.WriteLine(err.Message)
End Try
'insertDownload(ClientID)
'Response.Redirect(Request.Url.ToString)
' ResultStream = rs.Render("/" & sReportPath & "/" & sReportName, "PDF", Nothing, "<deviceinfo><streamroot>/RSWebServiceXS/", optionalParams, Nothing, Nothing, OptionalParam, OptionalParam, optionalParams, optionalWarnings, StreamIdentifiers)
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Type", contentType)
Response.AddHeader("Content-Disposition", "attachment;filename=" & WarningID & ".pdf")
Response.BinaryWrite(ResultStream)
Response.Flush()
Response.End()
End Using
|
|
|
|
|
Can you please tell me a sample format of username and password. Most probably it will be the issue of authorization. It will be happen when the username and password is correct or the user trying to access have no permission to access that server.Also try to pass username without specify domain.
|
|
|
|
|
Thanks for your response.
I am using the system administrator account details and I am not specifying the domain. I use something like this:
Username: administrator
Password: mylxghs
|
|
|
|
|
I hope that's not your real administrator password!
If it is, you should change it immediately.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
In which line do you get that exception?
|
|
|
|
|
Hi all,
I have a problem with default css template.
I downloaded free example css website template and I would like to apply to my Asp .NET MVC 4 project. I found some articles and one major movie in youtube which describes how to do that, but in version 3, which does not include @Razor...
Unfortunately I am not able to adjust this to my current version of asp .net version 4.
Could you be so kind and help me step by step how should i do that ?
Best Regards
|
|
|
|
|
You can follow the same steps in that video. The only changes will be the syntax. You should change aspx syntax to razor. can you provide me the youtube link you had tried? also let me where you are stuck. So i can help you one by one.
|
|
|
|
|
Dear Jameel,
Thanks for your reply. I finally did it. If I have any problems later I will ask you again for your help.
Meanwhile, thank you very much
Best regards
|
|
|
|
|
Good day friends.
I need an advice in this issue.
In order to keep section state alive, i used timer control to be downloading images every 5 secs. I wanted to use javascript but something came to my mind that what if javascript is not enabled in the client's device, so i had to use timer control as alternative. Now my question is, is it a good practice to use timer control in keeping section state alive and is it good for web applications? Any advice is welcome. Thanks!
|
|
|
|
|
Before answer you let me ask some questions...
Why keep the session alive?
Do you know how much it costs - in resources - to keep all your sessions alive?
Did you checked all the alternatives to live-forever-session?
I believe that after answering these question you will no ask the original question anymore...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
The timer control relies on javascript, so if javascript is not enabled, the timer won't work either.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Ok. Get it now. Thanks alot!
|
|
|
|
|