|
|
Hi, I'm just wondering if there's an ASP.NET data presentation control out there for data nested to an arbitrary depth i.e., a self-referencing table e.g., [Employees and their supervisors --> and tb_employee.supervisor_id references tb_employee.id] or [Categories and sub-categories --> tb_category.parent_id references tb_category.category_id, if top level it's set to null or 0].
Somewhat like a cross between a TreeView and Repeater.
TreeView comes close but you can only bind text and value...
Like a nested Repeater/GridView/DataGrid (take your pick) with the nested aspect being implicit.
I hope I'm being clear enough.
If as I suspect there isn't such a .NET control any advice is welcome.
|
|
|
|
|
There isn't any inbuilt .NET control. If you are just displaying the data, I recommend using repeater and nesting it. It's fast and you will get more control on the HTML.
|
|
|
|
|
Metal
---Gold
---Silver
---Bronze
Wood
---Oak
------Oak1
---Maple
Since the nesting levels are arbitrary I'd have to add the repeaters programmatically. I've had trouble with postback trying to do that in the past.
|
|
|
|
|
loupceuxl wrote: I've had trouble with postback trying to do that in the past.
Are you trying to display the data or you need your control to post back ? Have a look at here[^] to see nesting with repeater. This[^] also gives an insight to extending repeater. Repeater class is not sealed, hence you can create your own class which inherits from Repeater . Provide nesting functionalities to the custom created control
Hope this helps
|
|
|
|
|
Yeah, I've done this before when I knew how many levels of nesting there were going to be, usually 2 or 3. Although, unlike this example I wrote most of my code in the .cs page inside the OnItemDataBound event.
I'm looking for something where the following is NOT applicable:
"The data source must be regular in shape—it is not feasible to bind to a data source that is 2 levels deep in some places and 4 or 5 levels deep in others."
But that link you sent me is pointing in another direction, gonna check it out. Thx .
|
|
|
|
|
loupceuxl wrote: The data source must be regular in shape—it is not feasible to bind to a data source that is 2 levels deep in some places and 4 or 5 levels deep in others."
As I said go for custom control extending from Repeater.
loupceuxl wrote: But that link you sent me is pointing in another direction, gonna check it out. Thx .
Glad to know that it helped.
|
|
|
|
|
I get this error and can not find much information on this:
Warning 1 G:\ADEM\Forum\Forum.aspx: ASP.NET runtime error: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. (G:\ADEM\forum\web.config line 46) G:\ADEM\Forum\Forum.aspx 1 1 G:\ADEM\
Error 2 It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. G:\ADEM\Forum\Web.config 46
I am trying to run it from Visual Web Developer 2008 when I start the forum.aspx.
But in the web.config this is at line 46:
<authentication mode="Windows" />
<!-- AUTHORIZATION
This section sets the authorization policies of the application. You can allow or deny access
to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous
(unauthenticated) users.
-->
<authorization>
|
|
|
|
|
I am creating a website for www.adem.arkansas.gov... I am pretty much done with it but I wanted to add a forum to the website. I have searched and found this one that I liked.. Now it will be running on Windows Server 2003, but how do I know if everything works before I upload it to the server? I copied the files in the zip file to a folder Forum in the website.. what do I do now though?
|
|
|
|
|
It's better to post this on that articles discussion board.
|
|
|
|
|
|
After reading some more of the post it looks like it does not work with ASP.net 2.0... you wouldn't happen to know of any free discussion boards that use 2.0 do you?
|
|
|
|
|
|
i have a web page and i need to export part of it into word docment,the part i need to export it somthing like datagrid but it is calnder control,i use this code
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment;filename=FileName.doc");
Response.ContentEncoding = System.Text.Encoding.UTF7;
Response.ContentType = "application/vnd.word";
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
this.CalnderControl.RenderControl(oHtmlTextWriter);
Response.Output.Write(oStringWriter.ToString());
Response.Flush();
Response.End();
my problem is how can i modify the properties of that output word docment,as example if i need the output of word docment to be in landscape mode
and the another problem the output of this control is appear fine in the browser it render as html tables with cells but when be exported into word ,there are alot of additional cells appear and the word docment make this cells appear ,however the html output contain the true styles but i think somthing like borders the word couldnot understand it
So Can any one know how to export part of webpage into word docment that i can set some proberties to the output word docment,and make it appear as it appear in the browser??
and what i notic that in the result of that docment that it appear without that addtional cells in the reading outline view but the another views appear with that addtional cells,
|
|
|
|
|
Hi, thanks for looking
Id like to signout a user when session ends
I was thinking of handling session_end on global.asax (Im using InProc)
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
FormsAuthentication.SignOut()
End Sub
But it doesnt work
How could i accomplish this?
Im using sessions to store some info
Sessions info is loaded when users sign in
And dependnig on session info i load data from DB on some pages
This pages are only available to logged in users
While testing, my session is expiring and when i access the private pages, data is not being shown because session variables are nothing (session has expired), but im still logged in since im being able to see this pages
Is it very common that sessions info is lost before session times out? (I mean, in a normal situation) Not modifying web.config
Thanks in advance
Alexei Rodriguez
modified on Tuesday, April 1, 2008 7:57 PM
|
|
|
|
|
actually you need to call a function that chks whether a user is logged in or not in every authenticated form (on every Page_load regardless of postback condition).
when a session expires the user is logged out, what you need to do is to chk that condition -- that session variables are null and if true redirect them to the login screen. you can call FormsAuthentication.SignOut() as necessary.
I hope that helps
Thanks
Rocky
Success is a ladder which you can't climb with your hands in your pockets.
|
|
|
|
|
Hi there,
i'm trying to accomplish the following (however searching the net for days now, without result):
As you know you have a asp button:
<asp:Button ID="test" Text="Test" OnClick="Test_Button_Click">
this will launch the method "Test_Button_Click" on the server side. As i find the built in OS buttons ugly, i designed some new buttons myself, and it uses a table of 3 columns wide, and 1 row high. in the middle is a transparent button, only showing the text. In the left and right there are some images as background with some roundings (to make a smooth nice looking button).
The probem now is that i want to do the following:
<uc1:UserButton ID="Test" Text="Test" OnClick="Test_Button_Click">
but i can't get the OnClick attribute to work for the usercontrol, tried few different things that i found on the internet, and eventually it leaded me to launch javascript. PLease can someone tell me how to integrate a OnClick attribute that executes server code when clicked, specifically the method specified, as a normal button does? Thanks in advance!
Kind Regards,
Nick
|
|
|
|
|
That is probably a large enough topic to require some studying on your part. I would start here[^]
led mike
|
|
|
|
|
Hi led mike,
thanks for the reply. I took a look at the google link you gave me. I guess what I need is a bigger push in the right direction.
in my humble logic it seemed simple, could i just pass the onclick attribute entered in the usercontrol to the button in my usercontrol?
Kind Regards,
Nick Verlinden
|
|
|
|
|
One possible problem you are running into is the click location is in one of your user controls constituent controls because the user control might not have any actual screen area that is not occupied by a constituent. If they are asp controls you should be able to capture the constituent control OnClick events.
However I still suggest you study the subject by digging into that first search result item and/or some of the others. It's always better to have a solid understanding of what you are about to use.
led mike
|
|
|
|
|
I need a little help with some code I'm working on. I have a Datalist control that is throwing the following expeption.
------------------------------------------------------------------------
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
------------------------------------------------------------------------
Here is my code.
<br />
Sub Edit_Command(ByVal sender As Object, ByVal e As DataListCommandEventArgs) Handles DataList.EditCommand<br />
<br />
DataList.EditItemIndex = CType(e.Item.ItemIndex, Integer)<br />
<br />
Dim strDate As String = ""<br />
Dim strAssignments As String = ""<br />
Dim strSchool As String = ""<br />
Dim strProgramme As String = ""<br />
Dim strSubject As String = ""<br />
Dim strCity As String = ""<br />
Dim strState As String = ""<br />
Dim strReason As String = ""<br />
<br />
Dim reader As SqlDataReader<br />
Dim cmd As New SqlCommand("SELECT * FROM tblVolDeclinedMissedCanceledAssignments WHERE VolunteerId=" & VolunteerId() & " AND Id=" & e.CommandArgument, cn)<br />
cmd.CommandType = Data.CommandType.Text<br />
<br />
Try<br />
cn.Open()<br />
reader = cmd.ExecuteReader()<br />
<br />
While reader.Read<br />
strDate = IIf(IsDBNull(reader("Date")), "", reader("Date"))<br />
strAssignments = IIf(IsDBNull(reader("Assignment")), "", reader("Assignment"))<br />
strSchool = IIf(IsDBNull(reader("SchoolVenue")), "", reader("SchoolVenue"))<br />
strProgramme = IIf(IsDBNull(reader("Programme")), "", reader("Programme"))<br />
strSubject = IIf(IsDBNull(reader("Subject")), "", reader("Subject"))<br />
strCity = IIf(IsDBNull(reader("City")), "", reader("City"))<br />
strState = IIf(IsDBNull(reader("StateProvince")), "", reader("StateProvince"))<br />
strReason = IIf(IsDBNull(reader("Reason")), "", reader("Reason"))<br />
End While<br />
<br />
Catch ex As Exception<br />
Throw New ApplicationException(ex.Message)<br />
Finally<br />
cn.Close()<br />
End Try<br />
<br />
CType(e.Item.FindControl("rdpEditDate"), Telerik.WebControls.RadDatePicker).SelectedDate = strDate<br />
CType(e.Item.FindControl("ddlEditAssignments"), DropDownList).SelectedValue = strAssignments<br />
CType(e.Item.FindControl("txtEditSchoolVenue"), TextBox).Text = strSchool<br />
CType(e.Item.FindControl("ddlEditProgramme"), DropDownList).SelectedValue = strProgramme<br />
CType(e.Item.FindControl("ddlEditSubject"), DropDownList).SelectedValue = strSubject<br />
CType(e.Item.FindControl("txtEditCity"), TextBox).Text = strCity<br />
CType(e.Item.FindControl("ddlEditStateProvince"), DropDownList).SelectedValue = strState<br />
CType(e.Item.FindControl("txtEditReason"), TextBox).Text = strReason<br />
'Me.ddlEditAssignments.Items.FindByText(reader("Assignment")).Selected = True<br />
<br />
LoadDataMSCAData()<br />
End Sub<br />
The exception is thrown as soon as I hit the lines at the bottom where I am trying to assign the values from the datareader to the controls in the EditItemTemplate of the Datalist. What is really wierd about this is that I am using the exact same syntax to find the controls in my update command (below), and it works just fine.
Update Command:
<br />
Protected Sub DataList_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles DataList.UpdateCommand<br />
<br />
Dim arg As String = e.CommandArgument<br />
<br />
Dim strDate As String = CType(e.Item.FindControl("rdpEditDate"), Telerik.WebControls.RadDatePicker).SelectedDate.ToString<br />
Dim strAssignment As String = CType(e.Item.FindControl("ddlEditAssignments"), DropDownList).SelectedValue<br />
Dim strSchoolVenue As String = CType(e.Item.FindControl("txtEditSchoolVenue"), TextBox).Text<br />
Dim strProgramme As String = CType(e.Item.FindControl("ddlEditProgramme"), DropDownList).SelectedValue<br />
Dim strSubject As String = CType(e.Item.FindControl("ddlEditSubject"), DropDownList).SelectedValue<br />
Dim strCity As String = CType(e.Item.FindControl("txtEditCity"), TextBox).Text<br />
Dim strStateProvince As String = CType(e.Item.FindControl("ddlEditStateProvince"), DropDownList).SelectedValue<br />
Dim strReason As String = CType(e.Item.FindControl("txtEditReason"), TextBox).Text<br />
<br />
Dim sql As String<br />
<br />
Try<br />
sql = "UPDATE tblVolDeclinedMissedCanceledAssignments " & _<br />
"SET Date=@Date, Assignment=@Assignment, SchoolVenue=@SchoolVenue, Programme=@Programme, Subject=@Subject, City=@City, StateProvince=@StateProvince, Reason=@Reason " & _<br />
"WHERE VolunteerId=" & Me.VolunteerId & " AND Id=" & e.CommandArgument<br />
<br />
Dim cmd As New SqlCommand(sql, cn)<br />
cmd.Parameters.AddWithValue("@Date", strDate)<br />
cmd.Parameters.AddWithValue("@Assignment", strAssignment)<br />
cmd.Parameters.AddWithValue("@SchoolVenue", strSchoolVenue)<br />
cmd.Parameters.AddWithValue("@Programme", strProgramme)<br />
cmd.Parameters.AddWithValue("@Subject", strSubject)<br />
cmd.Parameters.AddWithValue("@City", strCity)<br />
cmd.Parameters.AddWithValue("@StateProvince", strStateProvince)<br />
cmd.Parameters.AddWithValue("@Reason", strReason)<br />
cn.Open()<br />
<br />
cmd.ExecuteNonQuery()<br />
<br />
Catch ex As Exception<br />
Throw New Exception<br />
Finally<br />
cn.Close()<br />
End Try<br />
<br />
DataList.EditItemIndex = -1<br />
LoadDataMSCAData()<br />
<br />
End Sub<br />
I have allreay read a bunch of forums and articals and can't figure out what I missing. If anyone here could tell me what I'm missing that would be great.
Thanks,
-Adam N. Thompson
|
|
|
|
|
I have my application migrated to VS2005 from VS2003, and the database is on MS SQL 2005.
I have couple of pages that have dynamic datagrids. When I run the application from within VS, it runs faster, loads the dynamic grid page faster than it does when I run outside of VS environment.
What causes it to run slower, outside the VS environment? How can I improve performance?
Thank You
Hashok
|
|
|
|
|
|
It's an entry page .. like Emp..
when I go to run .. there's some Textbox fields defined with a yellow back color ....
how can I prevent that ..
jooooo
|
|
|
|
|
kindman_nb wrote: It's an entry page .. like Emp..
when I go to run .. there's some Textbox fields defined with a yellow back color ....
Do you have the Google toolbar installed with the AutoFill feature switched on?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|