Menu.DynamicHorizontalOffset Property

In  this  article we'll  see  as  to  how  we can  use  ASP.NET  Menu's   DynamicHorizontalOffset    property  .

This  property  comes  very  handy  when  you  wanna  play  around  with the positioning  of  the  child menu   corresponding to its  parent menu  item.   Especially when  you are working  on  the  arabic  layout  of  the  page .  Actually  the  real  problem  comes when  you  create  a  DYNAMIC  menu  consisting  of  child  menu  items  as well.  So  by default ,  the positioning  of  child  menu items   comes  on  the  right  side of the menu   when  actually it  has  to  be  positioned  on  the left .  So  ,here  comes  the  DynamicHorizontalOffset   property  into  picture.

Given  below  is  an  example   as  to  how  we  can  st  this  property ,

private void PopulateMenu()
    {

              .....      //  Your  Stuff

              ......

              .....

          MyMenu.DynamicHorizontalOffset = -300;   //  MyMenu  is  the name of the  Menu

   }

 

-300  is  the  pixel  position  which  you  can  change  as per your  requirement .  The  above  syntax  has  given  especially  for  the  ARABIC  version  of   a page.


Tags: , , ,
Categories: ASP.NET

5 Comments
Actions: E-mail | Permalink | Comment RSSRSS comment feed

IE8 ,Google Chrome and Safari browsers not showing Dynamic Child Menu.

This  problem i have  faced  while developing a  page where i had to generate a dynamic  MENU ,comprising  of  data  coming  from  two  different tables that  were accumulated by  establishing  a RELATION  between  them  from  their  datasets. Now ,all it  was displaying was  a WHITE  background  for the Sub-Menus  in IE8 , Google Chrome and  Safari .

          So  , to  overcome  this  issue,  we need  to  add  a  ClientTarget property in  our  pages. But what  exactly  does  ClientTarget  property do ?  and  the  answer is "It Gets or sets a value that allows you to override automatic detection of browser capabilities and to specify how a page is rendered for particular browser clients."

  It  goes  like  this ,

 <% @ Page Language="C#" AutoEventWireup="true"  ClientTarget="uplevel" %>

 

In the Code-Behind Page, write this

Menu1.DynamicMenuStyle.CssClass = "DynamicMenuZIndex";  //  Menu1  is  the  name of  the MENU

 

StyleSheet.css

.DynamicMenuZIndex
{
    z-index: 999;
}

 

 After  adding  this , run  the application  and  see  the result..

Hope this  helps..

Please  do spare  some time  to write some  comment  regarding  this  post.

 

 


Tags: , , , , , ,
Categories: Browser

18 Comments
Actions: E-mail | Permalink | Comment RSSRSS comment feed

ASP.NET AJAX Auto Complete Extender with Database

Of late, there has been a lot of speculation about AJAX Control Toolkit's AutoComplete Extender. Basically , this control loads the data specific to the entered text..
So now we will see as to how to connect this control to database and fetch the data when the user enters a specific word or phrase.....

AutoComplete.aspx


 

 

Now let us see the code for web service that will help us in fetching the data..

AutoComplete.cs

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class AutoComplete : WebService
{
[WebMethod]

public string[] SearchDB(string prefixText, int count)
{
if (count == 0)
{
count = 10;
}

SqlConnection con = new SqlConnection("server=localhost;database=your database;uid=your username;pwd=your pwd");

string str = "select * from table where username like @prefixText";
con.Open();
SqlDataAdapter da = new SqlDataAdapter(str, con);

da.SelectCommand.Parameters.Add("@prefixText", SqlDbType.VarChar, 50).Value = prefixText + "%";
DataSet ds = new DataSet();
da.Fill(ds);

int cnt = ds.Tables[0].Rows.Count;
List items = new List(cnt);
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{


items.Add(ds.Tables[0].Rows[i]["UserName"].ToString());
}
return items.ToArray();

}
}


Stylesheet.css
/* AutoComplete highlighted item */

.autocomplete_highlightedListItem
{
background-color: #ffff99;
color: black;
padding: 1px;
}

/* AutoComplete item */

.autocomplete_listItem
{
background-color : window;
color : windowtext;
padding : 1px;
}

Now let's check out the result after running the application ..

 

 

 


NOTE:Please do comment regarding the article as it'll help me to write even more specifically..


Tags: , , , , , ,
Categories: ASP.NET

40 Comments
Actions: E-mail | Permalink | Comment RSSRSS comment feed

Failed to access IIS Metabase

 

This kind of error usually comes when you install ASP.NET first and then IIS. So as a solution to this , you just need to do one thing , write the given syntax in the command line and run it.


C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>aspnet-regiis -i



Hope this helps…


Tags: , ,
Categories: IIS

2 Comments
Actions: E-mail | Permalink | Comment RSSRSS comment feed

 


© Copyright 2009. www.onlineasp.net All Rights Reserved.