Posts

How to get user name of logon windows user.

This Code shows how to get user name of log on windows user. Here is the code : C# Code  string a; a = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString(); MessageBox.Show(a.ToString()); By Mohd Zulkamal NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)

How to specify WhereCondition in Transformation - Nested Control - kentico 8, 7, 6

Image
Before this i wonder how to pass some where condition in transformation repeater. So i ask the kentico guys and he give me a solution which i think i can share to the others. So in your transformation you can specify the <script runat="server"></script> element. This is where you can pass the where condition. Let see the example : Transformation Code <cms:queryrepeater id="repItems" ... DelayedLoading="true" ... /> <script runat="server"> protected void Page_PreRender(object sender, EventArgs e) { queryrepeater.WhereCondition= "NodeAliasPath LIKE '"+(string)Eval("NodeAliasPath")+"'"; queryrepeater.ReloadData(true); } </script> Note : queryrepeater dont have DelayedLoading properties, use DataBindByDefault="false" instead. By Mohd Zulkamal NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites

Update Panel - Handle async partial-page state with client script

This is a sample script you can put at the master page. So that you dont need to have updatepanel progress every time you add the update panel in you aspx page. Script  <div id="pageUpdating"></div>     <script type="text/javascript">         Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);         function BeginRequestHandler(sender, args) {             //page is begin request, you can put code to lock screen etc.               writePageLoading();         }         Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler)         function endRequestHandler(sender, args) {             //page load successfully , end request               RemoveLoading();             if (args.get_error() != undefined && args.get_error().httpStatusCode == '500') {                 //if have error                 var errorMessage = args.get_error().message;                 alert(errorMessage + &qu

Who is connected to database - Sample Application C#

Image
This is a sample application just to show who is currently connected into database MSSQL. The application actually just execute MSSQL command " sp_who " and show the data into datagrid. Below is a screen shoot of the sample application. Code Behind View Who Is Connected Form          public Form1()         {             InitializeComponent();         }         private void button2_Click(object sender, EventArgs e)         {             this.Close();         }         private void button1_Click(object sender, EventArgs e)         {             string ipaddress = textBox1.Text;             string username = textBox2.Text;             string password = textBox3.Text;             string dbNAme = textBox4.Text;             ViewUserActive form = new ViewUserActive();             form.popupInformation(ipaddress, username, password, dbNAme);                }         private void Form1_Load(object sender, EventArgs e)         {                  } Code Behind ViewUserActive Form      

Kentico 7 - Get Specific document information

This post will show how to get specific document information using Transformation In Kentico 7. Note : i have tested this method in kentico 7 only, donno if the other version will work. You can refer this link to create new transformation method Example : You can use this method in your transformation let say you create new repeater and want to show the parent name of the binding document type data. In this scenario, the document type store under different parent node.        public string getDocumentInfo(string documentID, string parentProperties)         {             TreeProvider tree = new CMS.DocumentEngine.TreeProvider(CMSContext.CurrentUser);             TreeNode Node = DocumentHelper.GetDocument(Convert.ToInt16(documentID), tree);             if (Node != null)             {                 switch (parentProperties)                 {                     case "NodeID": return Node.NodeID.ToString();                     case "NodeAliasPath": return Node.NodeAli

[SOLVED]Login failed for user ''. (Microsoft SQL Server, Error: 18456)

Image
If you want to try to connect to database using sql authentication and the result is failed due to error code "18456" , here are the solution that you might want to try. I already solved the issue (in my case the problem because of the database did not set to allow sql connection to pass. So the solution is to enable the SQL Server authentication. Enable SQL Server Authentication  Login to the SQL Server using windows authentication. Right click on the SQL Server node >> properties. Go to Security tab. Under SQL Authentication choose SQL Server and Windows Authentication mode. Click Ok Button. Go to Services . Control Panel >> Administrative tools >> Services >> Find SQLServer instance. Restart SQL Server instance. Try to login again using your login information. Done. By Mohd Zulkamal NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)

SQL view error "more column names specified than columns defined"

Error Executing Database Query. [Macromedia][SQLServer JDBC Driver][SQLServer]View or function 'dbo.myviewname' has more column names specified than columns defined. The error occur because of the original table has changed the column. So that the view definition will affected and whenever you perforl select statement the error will occur. Solution Resave the view table and the problem solve. By Mohd Zulkamal NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)