|
Use the "Ignore HTML" option when you are posting markup code.
---
Year happy = new Year(2007);
|
|
|
|
|
Sir
Where should I write my SIUD commands in my Code-behind Page or there should be a Class file named with our aspx file and in this file I should write the SIUD codes? What is the universal method for a proffessionals?
S.I.U.D means= Select, Insert, Update, Delete
Durgesh Kumar Mishra
|
|
|
|
|
SIUD
In general creating connections , issuing select, insert, update, and delete commands, and so on should be located in the Data Access Layer [^](DAL) class. your presentation layer (aspx) should not contain any references to such data access code, but should instead make calls into the DAL for any and all data requests
|
|
|
|
|
You're describing a 'no tier' methodology. Your data access should be in a seperate layer, which means not using the new MS stuff that forces you to write SQL in the aspx or the code behind.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi,
I have made a treeview, wich expand, when I remove the code:
root.NavigateUrl = "Default.aspx?id=" + ParentNode[loop, 0];
BUT I have to know, what Id (which node in the treeview the user select), to give the right input from the database.
I have stroggeld with this issue in many days now, but I still don't know what I shall do, so that when I redirect to Default, that it expand the treeview on that node, the user selected. Please can anybody help me?
My Code:
<br />
using System;<br />
using System.Data;<br />
using System.Configuration;<br />
using System.Web;<br />
using System.Web.Security;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;<br />
using System.Web.UI.HtmlControls;<br />
using System.Data.OleDb;<br />
<br />
public partial class _Default : System.Web.UI.Page <br />
{<br />
private OleDbConnection connection = null;<br />
public OleDbCommand command = null;<br />
public string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\Inetpub\\wwwroot\\Test\\Menu3\\menu.mdb;";<br />
<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
if (!IsPostBack)<br />
{<br />
fill_Tree();<br />
}<br />
}<br />
<br />
void fill_Tree()<br />
{<br />
<br />
connection = new OleDbConnection(connectionString); <br />
connection.Open();<br />
<br />
<br />
command = new OleDbCommand();<br />
command.Connection = connection;<br />
<br />
DataTable myDataTable = new DataTable();<br />
myDataTable.Columns.Add(new DataColumn("CategoryID", Type.GetType("System.String")));<br />
myDataTable.Columns.Add(new DataColumn("ParentCategoryID", Type.GetType("System.String")));<br />
myDataTable.Columns.Add(new DataColumn("CategoryName", Type.GetType("System.String")));<br />
command.CommandText = "SELECT * FROM CATEGORIES WHERE ParentCategoryID = 0";<br />
<br />
command.Parameters.Clear();<br />
<br />
<br />
OleDbDataReader myReader = command.ExecuteReader();<br />
<br />
<br />
command.Dispose();<br />
<br />
<br />
<br />
string[,] ParentNode = new string[100, 2];<br />
<br />
<br />
<br />
int count = 0;<br />
<br />
<br />
while (myReader.Read())<br />
{<br />
ParentNode[count, 0] = myReader.GetValue(myReader.GetOrdinal("CategoryID")).ToString();<br />
ParentNode[count++, 1] = myReader.GetValue(myReader.GetOrdinal("CategoryName")).ToString();<br />
}<br />
<br />
<br />
<br />
<br />
for (int loop = 0; loop < count; loop++)<br />
{<br />
<br />
TreeNode root = new TreeNode();<br />
root.Text = ParentNode[loop, 1];<br />
root.PopulateOnDemand = false;<br />
root.SelectAction = TreeNodeSelectAction.SelectExpand;<br />
<br />
<br />
<br />
root.NavigateUrl = "Default.aspx?id=" + ParentNode[loop, 0];<br />
<br />
myReader.Close();<br />
<br />
<br />
OleDbCommand Module_SqlCmd = new OleDbCommand("Select * from CATEGORIES where ParentCategoryID =" + ParentNode[loop, 0], connection);<br />
<br />
OleDbDataReader Module_Sdr = Module_SqlCmd.ExecuteReader();<br />
<br />
while (Module_Sdr.Read())<br />
{<br />
<br />
TreeNode child = new TreeNode();<br />
<br />
child.Text = Module_Sdr.GetValue(Module_Sdr.GetOrdinal("CategoryName")).ToString();<br />
<br />
child.Target = "_blank";<br />
<br />
child.NavigateUrl = "your_page_Url.aspx";<br />
<br />
root.ChildNodes.Add(child);<br />
}<br />
<br />
Module_Sdr.Close();<br />
<br />
TreeView1.Nodes.Add(root);<br />
<br />
}<br />
<br />
<br />
TreeView1.CollapseAll();<br />
connection.Close();<br />
<br />
}<br />
<br />
protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)<br />
{<br />
TreeView1.CollapseAll();<br />
ExpandNodes(TreeView1.SelectedNode.ValuePath);<br />
}<br />
<br />
private void ExpandNodes(string valuepath)<br />
{<br />
string[] tmp = valuepath.Split('/');<br />
string tmpValuePath = string.Empty;<br />
foreach (string s in tmp)<br />
{<br />
tmpValuePath += s;<br />
TreeView1.FindNode(tmpValuePath).Expand();<br />
tmpValuePath += "/";<br />
<br />
}<br />
}<br />
}<br />
Kind regards,
simsen
|
|
|
|
|
Try this..............
When u click on node. Get the selected noe and save in session variable.
when page is postback then check in session is not null then expand the selected node which store in session variable. otherwise do nothing.
if u'r problem is different plz clerify here.
Parwej Back...............DON of Developer.......
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
Hi Parwej,
Please can you give me som example code. I am a newbee, so I am a little lost in what you write to me
Kind regards,
simsen
|
|
|
|
|
Plz find this url............
http://www.15seconds.com/issue/041117.htm
Parwej Back...............DON of Developer.......
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
Hi Parwej
I am sorry, but I cannot see, what this helps me? I tried to use that code instead of my own. There is severel things here...... It don't expand/collapse when I click on the text (I don't want the arrows or other things - only text from my database).
I want it so, if I click on the text, it shall redirect to the same page, but with the id for the specific entry, I clicked on in the url, and it shall expand the tree again (after redirecting) so the same id is selected.
Like this:
Home
Products
...Cars
...Phones
...Laptops
Company
...Who we are
...Our location
Now when I load the site, it should look like this:
Home
Products
Company
When I click on Products it should redirect to the same site where in the url now instead of http://wwww.mypage.com/Default.aspx now sais http://www.mypage.com/Default.aspx?id=2 AND the menu should look like this:
Home
Products
...Cars
...Phones
...Laptops
Company
and so on.... Whith my first code, I could do everything .... only it don't expand the menu where I clicked.....
Can you please help me with this?
Kind regards,
simsen
|
|
|
|
|
I am trying to run asp.net applications on Windows XP home edition but I am unable to run the applications where it is throwing me an error message without opening the application.
I have installed Cassini but still its no use.
Message is:
---------------------------
Microsoft Development Environment
---------------------------
Visual Studio .NET has detected that the specified Web server is not running ASP.NET version 1.1. You will be unable to run ASP.NET Web applications or services.
-------------------------
Can you please help me out.
Thanks.
Amar.
|
|
|
|
|
This problems rise when u r install two version of framework....
Plz write this command. Follow the steps.........
(1)Go commnad prompt.......
(2)C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_regiis -i
Parwej Back...............DON of Developer.......
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
I tried the above solution but its still the same error.
|
|
|
|
|
plz view my blog........
http://gparwez.blogspot.com
Parwej Back...............DON of Developer.......
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
Unfortunately I am having Windows XP Home edition. When I went to Control Panel/Administrative tools - there is no IIS in there. What next....
|
|
|
|
|
XP Home is not for developers. You will not get IIS from XP Home OS. We can install IIS from some shortcut ways by changing registry and extracting some dl files from 2000 server and putting it in Root directory. But it will give you errors only. You will not get SMTP server also. Please install XP Professional.
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
|
|
|
|
|
I have a form that deletes users, I use a a dropdown to select the user I want to delete(using SQL Server Database), I want the first element to be "Please select one of the following"
How could it be?
Regards
|
|
|
|
|
Add the item to the data source before populating the list, or use the Insert method of the list to insert an item after you have populated it.
---
Year happy = new Year(2007);
|
|
|
|
|
Hi Dear
Thanks alot for your reply
give me a ststement how to use the insert method in my case, here i send you the code if needed:
If Not IsPostBack Then
conn1.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Hosting;Data Source=JICC"
conn1.Open()
Dim cm1 As New OleDbCommand("select * from Types", conn1)
Dim ds1 As New DataSet
Dim da1 As New OleDbDataAdapter
Dim dr1 As OleDb.OleDbDataReader
dr1 = cm1.ExecuteReader()
If dr1.HasRows = False Then
Label1.Text = "No records..."
Label1.Visible = True
DropDownList1.Enabled = False
Button1.Enabled = False
Else
Dim cmd1 As New OleDbCommand("select * from Types order by t_name", conn1)
da1.SelectCommand = cmd1
da1.Fill(ds1, "types")
DropDownList1.DataTextField = "t_name"
DropDownList1.DataValueField = "t_id"
DropDownList1.DataSource = ds1.Tables(0).DefaultView
DropDownList1.DataBind()
da1.Dispose()
End If
End If
|
|
|
|
|
ddlTitle.Items.Insert(0, New ListItem("Choose Title", "0"))
put this after finishing data binding.
|
|
|
|
|
thanks alot dear
it works
have a nice day
regards...
Nour Abdel-Salam
|
|
|
|
|
Lets say I have a bunch of html files stored on the server..is there any asp .net control that can be used to load a html file inside it and then allow me to change the html page that is loaded in it dynamically? or is there any other way that i can do such a thing??
|
|
|
|
|
Use an iframe or a frameset.
---
Year happy = new Year(2007);
|
|
|
|
|
How can I control the download of a zip file? CodeProject does this. When I click on a zip file link while I am not signed in it redirects me to login page.
Tomorrow is a blank page
|
|
|
|
|
You can simply point the link to a web page, say Download.aspx, instead of a zip file, and then you can authenticate the anonymous user with the ASP.NET.
|
|
|
|
|
Or you can monitor all incoming requests that whether they are authunticated or not in a custom developed http handler.
But be aware of the performance issue.
|
|
|
|