|
I have involved in developing my first Ajax .Net project and after nearly completing the project we have been testing performance of our application. We have found that the Ajax RoundedCornersExtender has a serious effect on the performance of our application and we improved query results from 4-5 seconds to less than a second by taking it out.
Thanks to firebug we isolated this. I really wish the toolkit controls where thoroughly tested before release.
Anyway, just thought I would share.
Jared
|
|
|
|
|
I have a master page that contains a simple table. There is probably a 10 pixel space between both the top and left sides of the screen. How do I remove this spacing?
I have tried div and table padding spacing? Any other suggestions?
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Found it, I needed to set the style on the body tag. Thought about that about 5 seconds after posting.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
hi everyone
i am desighning a global application in which i need to create a module of country-state and city module but i am having trouble
For example
http://msn.careerbuilder.com/jobseeker/resumes/postresumenew/postresumestart.aspx
If u just give any name and some text in covernote the next step will give u example of what i want and this can help me and many others...because with others i can cope with but with united kingdom post code its different story
|
|
|
|
|
This is a public site, most everything is of use to more than just one person
Are you asking how to create a dropdown with states and counties ?
only two letters away from being an asset
|
|
|
|
|
yes please but like it mathces to address for every country and good concept of storing that in sql database with search aspects
|
|
|
|
|
Hi, I am making an ASP.NET site with a menu on the side. The menu items are loaded from a database, and the items themselves are hyperlinks(at the moment) created dynamically for each item it finds in the database.
But how do I make the links work? I could just set the URL of it but I am just redirecting to the same page. When that page loads I want it to be able to tell what they just clicked(or if they just came to the site) and generate the content from there.
So I though maybe I could use sessions and then when the page loads it just checks the session with a couply if statements. Will this work? And if so, how do I do it? I have tried many different ways, but no matter what I try I cannot find a way to make a hyperlink do anything onclick besides going to its url.
Please help me, or if you have a better idea(which im sure you will, im new to this) them please share. Much appreciated.
Regards
Matt
|
|
|
|
|
http://www.devx.com/tips/Tip/5498[^]
You can call javascript from an anchor tag ( a hyperlink )
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Have you looked at the menu control in the toolbox?
only two letters away from being an asset
|
|
|
|
|
Look into DataBinding if I understand you correctly, it is very easy to use a repeater control and use data binding to fill in all the data.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Hi! I couldnt maintain the state of the treeview after postback. searched all over but i could seem to solve the problem. below is the code that i am using so it will be easier to understand whta i am doing. also i have having problem navigating to the same url with parameter on it. for e.g. if the node id is 5 i want to postback as tree.aspx?id=5
Imports System.Data.SqlClient
Imports System
Imports System.Collections.Generic
Imports System.Web
Imports System.Web.UI.WebControls
Partial Public Class tree
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
PopulateRootLevel()
End If
'TreeView1.CollapseAll()
' get the saved state of all nodes.
Dim treeViewState As New TreeViewState()
treeViewState.SaveTreeView(TreeView1, Me.GetType.ToString())
End Sub
Private Sub PopulateRootLevel()
Dim objConn As New SqlConnection("server=APEX-KEV3;uid=sa;pwd=password2133;database=TaxnologyOnlineDev")
Dim objCommand As New SqlCommand("select LocationId,LocationName,(select count(*) FROM Location " _
& "WHERE parentlocationid=sc.locationid) childnodecount FROM Location sc where parentlocationID is null and locationid=3", _
objConn)
Dim da As New SqlDataAdapter(objCommand)
Dim dt As New DataTable()
da.Fill(dt)
PopulateNodes(dt, TreeView1.Nodes)
End Sub
Private Sub PopulateNodes(ByVal dt As DataTable, ByVal nodes As TreeNodeCollection)
For Each dr As DataRow In dt.Rows
Dim tn As New TreeNode()
tn.Text = dr("locationname").ToString()
tn.Value = dr("locationid").ToString()
nodes.Add(tn)
'If node has child nodes, then enable on-demand populating
tn.PopulateOnDemand = (CInt(dr("childnodecount")) > 0)
Next
End Sub
Private Sub PopulateSubLevel(ByVal parentid As Integer, ByVal parentNode As TreeNode)
Dim objConn As New SqlConnection("server=APEX-KEV3;uid=sa;pwd=password2133;database=TaxnologyOnlineDev")
Dim objCommand As New SqlCommand("select LocationId,LocationName,(select count(*) FROM Location " _
& "WHERE parentlocationid=sc.locationid) childnodecount FROM Location sc where parentlocationID=@parentID", _
objConn)
objCommand.Parameters.Add("@parentID", SqlDbType.Int).Value = parentid
Dim da As New SqlDataAdapter(objCommand)
Dim dt As New DataTable()
da.Fill(dt)
PopulateNodes(dt, parentNode.ChildNodes)
End Sub
Protected Sub TreeView1_TreeNodePopulate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.TreeNodeEventArgs) Handles TreeView1.TreeNodePopulate
PopulateSubLevel(CInt(e.Node.Value), e.Node)
End Sub
Protected Sub TreeView1_SelectedNodeChanged(ByVal sender As Object, ByVal e As EventArgs) Handles TreeView1.SelectedNodeChanged
If TreeView1.SelectedNode.Value <> String.Empty Then
Response.Redirect("tree.aspx?id=" + TreeView1.SelectedNode.Value)
End If
End Sub
Protected Sub TreeView1_Unload(ByVal sender As Object, ByVal e As EventArgs) Handles TreeView1.Unload
' save the state of all nodes.
Dim tvs As New TreeViewState
tvs.SaveTreeView(TreeView1, Me.GetType().ToString())
End Sub
End Class
Public Class TreeViewState
Public Sub SaveTreeView(ByVal treeView As TreeView, ByVal key As String)
Dim list As New List(Of System.Nullable(Of Boolean))()
SaveTreeViewExpandedState(treeView.Nodes, list)
HttpContext.Current.Session(key + treeView.ID) = list
End Sub
Private RestoreTreeViewIndex As Integer
Public Sub RestoreTreeView(ByVal treeView As TreeView, ByVal key As String)
Dim list As New List(Of Nullable(Of Boolean))
If HttpContext.Current.Session(key + treeView.ID) IsNot Nothing Then
list = CType(HttpContext.Current.Session(key + treeView.ID), List(Of Nullable(Of Boolean)))
End If
RestoreTreeViewIndex = 0
RestoreTreeViewExpandedState(treeView.Nodes, list)
End Sub
Private Sub SaveTreeViewExpandedState(ByVal nodes As TreeNodeCollection, ByVal list As List(Of System.Nullable(Of Boolean)))
For Each node As TreeNode In nodes
list.Add(node.Expanded)
If node.ChildNodes.Count > 0 Then
SaveTreeViewExpandedState(node.ChildNodes, list)
End If
Next
End Sub
Private Sub RestoreTreeViewExpandedState(ByVal nodes As TreeNodeCollection, ByVal list As List(Of System.Nullable(Of Boolean)))
For Each node As TreeNode In nodes
If RestoreTreeViewIndex >= list.Count Then
Exit For
End If
node.Expanded = list(System.Math.Max(System.Threading.Interlocked.Increment(RestoreTreeViewIndex), RestoreTreeViewIndex - 1))
If node.ChildNodes.Count > 0 Then
RestoreTreeViewExpandedState(node.ChildNodes, list)
End If
Next
End Sub
End Class
i am using visual studio .net 2.0 treeview control
please help
thanks
|
|
|
|
|
You don't need to create a class to do what is already available. EnableViewState = true
only two letters away from being an asset
|
|
|
|
|
hi!
enableviewstate is by default made true for treeview control. may be i have misunderstood what you are trying to say. could you please explain me in detail?
originally the page loads as "tree.aspx". each node has its id and value(which is an integer) all i am trying to do is display a datagrid on the left based on the node they select. lets say if they select sub node of id 5. I am tryign to maintain that expanded subnode plus redirect as
tree.aspx?id=5 (based on which the grid will be filtered. please note the treeview is in left.ascx and grid is in tree.aspx.
please help
thanks in advance
-- modified at 19:45 Wednesday 14th November, 2007
|
|
|
|
|
You have the treeview in a user control that is placed on the same page as the grid? Is this correct?
If so, why pass the id via query string? Handle the selectionchanged event on the page.
only two letters away from being an asset
|
|
|
|
|
nope. treeview is in user control and grid is in a webform. how can i pass value from user control(ascx) to webform(aspx)
|
|
|
|
|
Mark Nischalke wrote: You have the treeview in a user control that is placed on the same page as the grid?
uglyeyes wrote: treeview is in user control and grid is in a webform
A user control is not a separate webpage, it must be placed on a webpage.
It seems you have a bit learn about the technology involved before attempting this.
only two letters away from being an asset
|
|
|
|
|
hi I did grid handling on tree node selection change now I am having problem in data sorting. I am using griview control below are my codes
Protected Sub dgAssets_Sorting(ByVal sender As Object, ByVal e As GridViewSortEventArgs)
Response.Write(dgAssets.DataSource.GetType().ToString)
Dim dataTable As DataTable = TryCast(dgAssets.DataSource, DataTable)
If dataTable IsNot Nothing Then
Dim dataView As New DataView(dataTable)
dataView.Sort = e.SortExpression + " " + ConvertSortDirectionToSql(e.SortDirection)
dgAssets.DataSource = dataView
dgAssets.DataBind()
End If
End Sub
|
|
|
|
|
here are all the codes.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
PopulateRootLevel()
End If
dgAssets.DataBind()
End Sub
Private Sub PopulateRootLevel()
Dim myDal As New clsDAL
Dim dt As DataTable
Try
dt = myDal.getRootLocation
PopulateNodes(dt, TreeView1.Nodes)
TreeView1.CollapseAll()
' get the saved state of all nodes.
Dim treeViewState As New TreeViewState()
treeViewState.SaveTreeView(TreeView1, Me.GetType.ToString())
Catch ee As Exception
Throw ee
myDal.UpdateErrorLog(ee.Message, ee.TargetSite.Name.ToString())
End Try
End Sub
Private Sub PopulateNodes(ByVal dt As DataTable, ByVal nodes As TreeNodeCollection)
For Each dr As DataRow In dt.Rows
Dim tn As New TreeNode()
tn.Text = dr("locationname").ToString()
tn.Value = dr("locationid").ToString()
nodes.Add(tn)
'If node has child nodes, then enable on-demand populating
tn.PopulateOnDemand = (CInt(dr("childnodecount")) > 0)
Next
End Sub
Private Sub PopulateSubLevel(ByVal parentid As String, ByVal parentNode As TreeNode)
Dim dt As DataTable
Dim myDal As New clsDAL
Try
dt = myDal.getChildLocation(parentid)
Catch ee As Exception
Throw ee
myDal.UpdateErrorLog(ee.Message, ee.TargetSite.Name.ToString())
End Try
PopulateNodes(dt, parentNode.ChildNodes)
End Sub
Protected Sub TreeView1_TreeNodePopulate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.TreeNodeEventArgs) Handles TreeView1.TreeNodePopulate
PopulateSubLevel(CStr(e.Node.Value), e.Node)
End Sub
Protected Sub TreeView1_SelectedNodeChanged(ByVal sender As Object, ByVal e As EventArgs) Handles TreeView1.SelectedNodeChanged
'If TreeView1.SelectedNode.Value <> String.Empty Then
' Response.Redirect(TreeView1.SelectedNode.Value)
'End If
'Session("loc") = TreeView1.SelectedNode.Value
' getLocationId = TreeView1.SelectedNode.Value
locid.Text = TreeView1.SelectedNode.Value
bcId.Text = 0
binddata()
End Sub
Public Sub binddata()
Dim myDAL As New clsDAL
Dim LocationId As Integer
Dim BuildingComponentId As Integer = bcId.Text
If locid.Text <> Nothing Then
LocationId = locid.Text
Else
LocationId = 0
End If
Try
Dim dt As DataTable = myDAL.getAssetsByProperty(LocationId, BuildingComponentId)
dgAssets.DataSource = dt
dgAssets.DataBind()
Catch ee As Exception
Throw ee
myDAL.UpdateErrorLog(ee.Message, ee.TargetSite.Name.ToString())
End Try
End Sub
Protected Sub TreeView1_Unload(ByVal sender As Object, ByVal e As EventArgs) Handles TreeView1.Unload
' save the state of all nodes.
Dim tvs As New TreeViewState
tvs.SaveTreeView(TreeView1, Me.GetType().ToString())
End Sub
Function ConvertSortDirectionToSql(ByVal sortDirection As SortDirection) As String
Dim newSortDirection As String = Nothing
Select Case SortDirection
Case sortDirection.Ascending
newSortDirection = "ASC"
Exit Select
Case sortDirection.Descending
newSortDirection = "DESC"
Exit Select
End Select
Return newSortDirection
End Function
'Protected Sub dgAssets_Sorting(ByVal sender As Object, ByVal e As GridViewSortEventArgs)
' ' Response.Write(dgAssets.DataSource.GetType().ToString)
' Dim dataTable As DataTable = TryCast(dgAssets.DataSource, DataTable)
' If dataTable IsNot Nothing Then
' Dim dataView As New DataView(dataTable)
' dataView.Sort = e.SortExpression + " " + ConvertSortDirectionToSql(e.SortDirection)
' dgAssets.DataSource = dataView
' dgAssets.DataBind()
' End If
'End Sub
'Protected Sub dgAssets_PageIndexChanging(ByVal sender As Object, ByVal e As GridViewPageEventArgs)
' binddata()
' dgAssets.PageIndex = e.NewPageIndex
' dgAssets.DataBind()
'End Sub
'CUSTOM
Private Property GridViewSortDirection() As String
Get
Return IIf(TryCast(ViewState("SortDirection"), String) Is Nothing, "ASC", TryCast(ViewState("SortDirection"), String))
End Get
Set(ByVal value As String)
ViewState("SortDirection") = value
End Set
End Property
Private Property GridViewSortExpression() As String
Get
Return IIf(TryCast(ViewState("SortExpression"), String) Is Nothing, String.Empty, TryCast(ViewState("SortExpression"), String))
End Get
Set(ByVal value As String)
ViewState("SortExpression") = value
End Set
End Property
Private Function GetSortDirection() As String
Select Case GridViewSortDirection
Case "ASC"
GridViewSortDirection = "DESC"
Exit Select
Case "DESC"
GridViewSortDirection = "ASC"
Exit Select
End Select
Return GridViewSortDirection
End Function
Protected Function SortDataTable(ByVal dataTable As DataTable, ByVal isPageIndexChanging As Boolean) As DataView
If dataTable IsNot Nothing Then
Dim dataView As New DataView(dataTable)
If GridViewSortExpression <> String.Empty Then
If isPageIndexChanging Then
dataView.Sort = String.Format("{0} {1}", GridViewSortExpression, GridViewSortDirection)
Else
dataView.Sort = String.Format("{0} {1}", GridViewSortExpression, GetSortDirection())
End If
End If
Return dataView
Else
Return New DataView()
End If
End Function
Protected Sub dgAssets_PageIndexChanging(ByVal sender As Object, ByVal e As GridViewPageEventArgs)
dgAssets.DataSource = SortDataTable(TryCast(dgAssets.DataSource, DataTable), True)
dgAssets.PageIndex = e.NewPageIndex
dgAssets.DataBind()
End Sub
Protected Sub dgAssets_Sorting(ByVal sender As Object, ByVal e As GridViewSortEventArgs)
GridViewSortExpression = e.SortExpression
Dim pageIndex As Integer = dgAssets.PageIndex
dgAssets.DataSource = SortDataTable(TryCast(dgAssets.DataSource, DataTable), False)
dgAssets.DataBind()
dgAssets.PageIndex = pageIndex
End Sub
End Class
|
|
|
|
|
Hello
I'm using parameters and values (return from function) in url like below, But it doesn't work.
Parameters are : imagepath (return from function), width, height
ImageUrl='MakeThumbnail.aspx?file=<%# getImagePath(Convert.ToString(DataBinder.Eval(Container, "DataItem.date")), "news") %>&width=<%# DataBinder.EvalContainer, "DataItem.imagewidth")%>&height=100'
Please help
|
|
|
|
|
Please don't double post.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Use the Server.UrlEncode method to encode the values properly for being put in an url.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
freshonlineMax wrote: But it doesn't work.
Why doesn't it work? You should provide basic background information about your problem if you want help. Just saying that something doesn't work isn't good enough.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
I have an asp.net web page (viewxml.aspx) which accessess a sql server 2005 database record. I have a field called xmlfile which I am converting back to the xml datatype from varbinary(max) successfully. Trouble is it's hard to read. Now I need to display the field's contents as an xml file so that it can be used easily for troubleshooting. (I need display the xml formatting that is displayed automatically with the .xml file type.) I need to code it within my viewxml.aspx.vb file. I plan to use a button click event to trigger the output. Any help would be welcomed!
|
|
|
|
|
Put the XML in an XMLDocument and set the property that makes the output formatted ( forget what it is ). Then I think there's a server control to display XML. If there isn't, use a literal and HTML encode the XML string first.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
That was very non-specific and not helpful at all. 1)I do not know how to do the first thing (that was my question - how to output to a xml file and 2)there is no xml server control that I know of and 3)I don't know how to do the third thing.
|
|
|
|