try { this.EnableViewState = false; Response.ContentType = "text/xml"; // chnage the content type accordingly string Filename = System.Web.HttpContext.Curr... Filename = “abc.txt“; Response.WriteFile(Filename); string strFilename =“abc.txt"; Response.Buffer = true; Response.AddHeader("Content... "attachment; filename=" + strFilename); } catch (Exception ex) { Response.Write(ex.ToString()); } Response.End(); ......
Serialize (convert an object instance to an XML document): // Assuming obj is an instance of an object XmlSerializer ser = new XmlSerializer(obj.GetType()); System.Text.StringBuilder sb = new System.Text.StringBuilder(); System.IO.StringWriter writer = new System.IO.StringWriter(sb); ser.Serialize(writer, obj); XmlDocument doc = new XmlDocument(); doc.LoadXml(sb.ToString()); Deserialize (convert an XML document into an object instance): //Assuming doc is an XML document containing a serialized object ......
Convert a string to a byte array string myString = "a test string";byte[] myByteArray = new byte[myString.Length];int i = 0;foreach(char c in InStr.ToCharArray()){ myByteArray [i] = (byte)c; i++;} Convert a byte array to a string System.Text.Encoding enc = System.Text.Encoding.ASCII;... myByteArray = enc.GetBytes("a text string);string myString = enc.GetString(myByteArray ); ......
In computer networking, the Lightweight Directory Access Protocol, or LDAP ("ell-dap"), is a networking protocol for querying and modifying directory services running over TCP/IP. An LDAP directory usually follows the X.500 model: it is a tree of entries, each of which consists of a set of named attributes with values. While some services use a more complicated "forest" model, the vast majority use a simple starting point for their database organization. An LDAP directory often reflects various political, ......
You need to define which Textbox and Button you want to make them default. // add the attribute in your form tag <form id="form1" DefaultButton="Button1" DefaultFocus="TextBox2" runat="server"> ......
//// Code Snippet <form id="form1" runat="server"> <div> <h3>To Exceute Client Click Event</h3> <asp:Button ID="Button1" OnClientClick='javascript:a... Just Clicked ME!")' OnClick="Button1_Click" Text="Click Me!" runat="server" /> </div> </form> ......
//Function to get the HTML name of the server control from the Client Id // Parameters: // clientId - Control.ClientId // serverId - Control.id private string GetHTMLNameById(string clientId, string serverId) { int pos = serverId.IndexOf('_'); string HTMLName = ""; if(pos >= 0) { pos = clientId.IndexOf(serverId); HTMLName = clientId.Remove(pos, serverId.Length); HTMLName = HTMLName.Replace('_', '$'); HTMLName += serverId; } else HTMLName = clientId.Replace('_', '$'); return HTMLName; } ......