Google Brother Up

Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts

2009/04/06

C# Code to Dynamically Change Title of a Page

C# Code to Dynamically Change Title of a Page: -


[title]My Website - [%=Request.QueryString["Mode"]%] form[/title]

* Replace the [ by <>

256 unique visitors

2009/03/21

Website - Sorting of String by Array / LINQ / Lists

http://dotnetperls.com/Content/Sorting-String-Array.aspx

236 unique visitors

A different way to insert Data into a Gridview from array

strProjListFinal = strAERProjList.Trim() + ";" + strIAProjList.Trim();
string[] strs = strProjListFinal.Split(';');
ddlProjectName.Items.Clear();
foreach (string s in strs)
{
ddlProjectName.Items.Add(s.Trim());
}
ddlProjectName.Items.Insert(0, new ListItem("All Projects", "-1"));


236 unique visitors

2009/02/24

Alert Message using Response.Write in Web through C# Code

1) Hardcoded Alert

Response.Write("{script}alert("Hello");{/script}");

2) Variable Alert

string txtName = "Hello " + txtText.Text;
Response.Write("{script}alert('" + txtName + "');{/script}");

205 unique visitors

2008/12/19

Split a string separated by ";" and place in an array

How to split a string like this ";1;2;3;4;5;6" and put in on an array?

string mstrStream = mstrSelectedRowsStream.Remove(0,1); // to remove the semicolon on the extreme left

char chSep = ';';
string[] arrStr = mstrStream.Split(chSep);


How to get each number back from that array?

for (int i = 0; i <>
{
     string s = arrStr[i].ToString();
}

145 unique visitors

2008/12/12

Fundas on Server Paths

1. Server.MapPath(strPath)

2. (asp:Image ImageUrl=“~/images/pictures.gif runat=“server“/)

3. TextWriter tw = new StreamWriter(~"\\servername\test.txt");
tw.WriteLine("test1");
tw.Close();


4. @"C:\test\source\folder3.cs")

143 unique visitors

How to get a Path & Xml file values into a Dataset

string dtxmlFilePath = "datatypes.xml";

FileStream dtFileStream = new FileStream(Server.MapPath(dtxmlFilePath), FileMode.Open, FileAccess.Read);

StreamReader dtXmlStream = new StreamReader(dtFileStream);

ds.Tables[0].ReadXml(dtXmlStream);

dtFileStream.Close();

143 unique visitors

2008/05/08

THIS DATASOURCE DOES NOT SUPPORT SERVER-SIDE DATA PAGING

To solve this problem (THIS DATASOURCE DOES NOT SUPPORT SERVER-SIDE DATA PAGING ), you must set GridView DataSource Property as DataSet not DataReader .

Drop Down List

1. http://www.janetsystems.co.uk/Articles/NetArticles/tabid/74/itemid/161/modid/449/Default.aspx