|
Scope. The scope of standard modules is the entire app life.
Class modules can be instantiated and destroyed anytime. I
put my connection strings and all related (encrypted) in
the stan. module..you can do either.
|
|
|
|
|
Hi
This is Urgent,
Can anyone tell me tht how should i use menu's in ASP.net application . I want only main menu's should be displayed . But when mouse pointer is taken over it , it should show me sub menus within it .And the sub menu should disappear again when pointer of mouse is taken away from main menu. If possible plz pass on the code.
Thanks in Advance
|
|
|
|
|
Hi,
Assuming that you are using ASP.NET 2.0 framework, there's a nice Menu control provided in ASP.NET 2.0 which you can easily use for the same.
Given below is the strategy and the code for the same.
Table Design -
CREATE TABLE [dbo].[Menu_Master] (
[Menu_ID] [int] NOT NULL ,
[Menu_Name] [varchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[Menu_Desc] [varchar] (300) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Parent] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Sequence] [int] NOT NULL ,
[OnClickAction] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Roles] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Menu_Master] WITH NOCHECK ADD
CONSTRAINT [PK_Menu_Master] PRIMARY KEY CLUSTERED
(
[Menu_ID]
) ON [PRIMARY]
GO
__________________________________________________________________________
Menu populating Method -
private void PopulateMenu(SqlDataReader dtMenuData, ref Menu popdownMenu)
{
Hashtable RootNodeReferrer = new Hashtable( );
SqlDataReader MenuData;
int Counter = 0;
int Level = 0;
int Id = 0;
MenuItem PopDownMnuItem;
MenuData = dtMenuData;
try
{
while (MenuData.Read( ))
{
Id = Convert.ToInt32(MenuData["Menu_ID"]);
PopDownMnuItem = new MenuItem( );
if (Level == Convert.ToInt32(MenuData["Parent"]))
{
PopDownMnuItem.Text = MenuData["Menu_Name"].ToString( );
PopDownMnuItem.NavigateUrl = MenuData["OnClickAction"].ToString( );
PopDownMnuItem.Value = Counter.ToString( );
PopDownMnuItem.ToolTip = MenuData["Menu_Desc"].ToString( );
if (MenuData["OnClickAction"].ToString( ).Trim( ) != "")
{
PopDownMnuItem.Selectable = true;
}
else
{
PopDownMnuItem.Selectable = false;
}
if (Counter != 0)
{
MenuItem SepItem = new MenuItem("", "", "~\\Images\\VerMenuSep.jpg", "");
popdownMenu.Items.Add(SepItem);
}
popdownMenu.Items.Add(PopDownMnuItem);
RootNodeReferrer.Add(Id, PopDownMnuItem.ValuePath);
}
else
{
MenuItem ParentItem = popdownMenu.FindItem(RootNodeReferrer[Convert.ToInt32(MenuData["Parent"])].ToString( ));
if (ParentItem != null)
{
PopDownMnuItem.Text = MenuData["Menu_Name"].ToString( );
PopDownMnuItem.NavigateUrl = MenuData["OnClickAction"].ToString( );
PopDownMnuItem.Value = Counter.ToString( );
PopDownMnuItem.ToolTip = MenuData["Menu_Desc"].ToString( );
if (MenuData["OnClickAction"].ToString( ).Trim( ) != "")
{
PopDownMnuItem.Selectable = true;
}
else
{
PopDownMnuItem.Selectable = false;
}
ParentItem.ChildItems.Add(PopDownMnuItem);
RootNodeReferrer.Add(Id, PopDownMnuItem.ValuePath);
}
}
Counter++;
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
MenuData = null;
RootNodeReferrer = null;
PopDownMnuItem = null;
}
}
This method will populate the menu control with data fetched from the database and iterate through all the rows to create the required structure.
The important point to remember here is the way the actual data has to be populated in database. There are 3 main columns - Menu_Id, ParentId and Sequence. The importance is that Menu id will be a unique id, parent Id will give the id of menu level which acts as its parent and sequence will be the sequence in which a particular structure is created.
For eg - If we want a structure like
1 / 2,3
2 / 4,5,6
the Menu id will be
1 1 1 0 0(follow the above column structure)
2 2 2 1 1
3 3 3 1 2
4 4 4 2 1
5 5 5 2 2
6 6 6 2 3
I hope u got this point.. Its difficult to describe it visually.. still I have tried to do so..
This should solve all ur problems.
Thanks and best regards
Omkar Ghaisas
|
|
|
|
|
|
Hi friends.
I am cearting my website using Asp.net ( code C# ) and sqlserver2000... I need "search" in a webform.
for example, when the user types " demo " in the textbox of the search page, then it should appear all the things in all pages of the website,which is correlate with the word "demo".
Just like the search in codeproject.
how can I do it ?
I just know about searching with a specific field,like user name,age,... but I dont have any idea about a word searching ...
is there any articles which can help me?
Or can anyone help me to write ...?
thanks alot.
|
|
|
|
|
You want to use a 'like' query on your database which allows you to search through string which 'looks like' your string... the syntax is easy
select field1, field2 from table where field1 like '%demo%'
this returns all rows where field1 contains the string 'demo'. However, you may consider using and/or functionality in your websearch, for example when a visitor enters demo+csharp in the textbox. Your query should look like this
select field1, field2 from table where field1 like '%demo%' and field1 like '%csharp%'
If the user enters 'demo csharp' as search text, you want
select field1, field2 from table where field1 like '%demo%' or field1 like '%csharp%'
This makes searching complicated. Afterwards you want to sort the result set having the most relevant match on top. For example you can count the number of matches for each result in the result set and order the result set depending on that number of matches having the most matches on top.
You can make search functionality as easy or as complicated as you want...
|
|
|
|
|
hai,
i am working on asp.net1.1(vb.net). when i am accessing the application from server ,getting the following error
where i have to correct this.
please provide some solutions.
thanks and regards,
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customerrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customerrors> tag should then have its "mode" attribute set to "Off".
<configuration>
<system.web>
<customerrors mode="Off">
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customerrors> configuration tag to point to a custom error page URL.
<configuration>
<system.web>
<customerrors mode="RemoteOnly" defaultredirect="mycustompage.htm">
surendra
|
|
|
|
|
Plz try this..........
<'configuration>
<'system.web>
<'customErrors mode="Off"/>
<'/system.web>
<'/configuration>
Parwej Back...............DON of Developer.......
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
thanks for your reply..problem solved ,in server this property is to be adjusted.
Thanks and regards
surendra
|
|
|
|
|
string m_path;
m_path = Server.MapPath(".").ToString();
FileInfoCollection objFiles = new FileInfoCollection();
DirectoryInfo objSecondDir = new DirectoryInfo(m_path + "\\"
+ "PoliciesProcedures");
objFiles.AddRange(objSecondDir.GetFiles());
int totalfiles = objFiles.Count;
GridPolicyUpload.DataSource = objFiles;
GridPolicyUpload.DataBind();
now for this DirectoryInfo i need to make a datatable and insert in it. Since i had to do sorting in it .
i tried with this
DataColumn myDataColumn;
myDataColumn = new DataColumn();
myDataColumn.DataType = Type.GetType("System.String");
myDataColumn.ColumnName = "Name";
myDataTable.Columns.Add(myDataColumn);
myDataTable.Rows.Add(objFiles.T
but i could'nt ????????
can anyone help me out ???????
thanks in advance
|
|
|
|
|
Try this......
DataColumn myDataColumn;
myDataColumn = new DataColumn();
myDataColumn.DataType = Type.GetType("System.String");
myDataColumn.ColumnName = "Name";
myDataTable.Columns.Add(myDataColumn);
DataRow dr=myDataTable.NewRow();
dr["Name"] = objFiles.T
myDataTable.Rows.Add(dr)
Parwej Back...............DON of Developer.......
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
Hi all,
I am working in dot net 2005. Is it possible to send sms from aspnet(2005). if yes please give me some samples.
Thanking You...
Sebastian
|
|
|
|
|
I used this service provider in my last project. If you want you can use this also.
Try some 5 free sms on this site
http://www.intellisms.co.uk/[^]
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
hi Sylvester ,
actually i want to send a secure number to the user as a SMS,when i click a button. Is this possible?
thanks a lot...
sebastian
|
|
|
|
|
|
Thank you , i will check it out
sebastian
|
|
|
|
|
|
|
hi,
I am dynamically generating Imagebutton (say 5 imagebutton, in loop) .
for each imagebutton url , i am dynamically generating image and assigining to it.
every thing is ok upto this stage.
The problem arises when i click on particular image button
i want to know which image button is clicked, in click event and take appropriate actions.
i have saved image like
bmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif);
|
|
|
|
|
why dont you add a particular event while you are generating ImageButton?
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
hi
can any one tell me that is it possible to get the windows nt login information when he open our site in his browser as normally get his info like operating system etc through server variables
regards
shezi
|
|
|
|
|
Yes.
Dim strNetworkUser As String = HttpContext.Current.User.Identity.Name.ToString()
That will return the domain and username. You can then just split the string at the "/" to get just the name.
|
|
|
|
|
plus. you have to deny "Anonymous Access".
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
|
my code is like this
MailMessage mail=new MailMessage();
mail.To ="anu@gmail.com";
mail.From ="anu2@gmail.com";
mail.Subject = "Hai";
mail.Body = "your subject";
SmtpMail.Send(mail);
it's executing.but i am not getting msg in my mail?what is the problem?
When i am using this code
Smtpmail.send(="anu@gmail.com","anu2@gmail.com","Hai","your subject")
i am getting mail in anu2
can anyone tell what is the problem in above code? is there any thing i haveto set in webconfig file?Then How?.......
Can anyone please help me?..it's urgent
|
|
|
|