
legendgod
Avatar/Signature-
Posts
53 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by legendgod
-
I have a datagrid which one of the row display the datetime in this way: 2/6/2004 1:00:00 The code is like that: <asp:TemplateColumn HeaderText="Date"> <ItemTemplate> <asp:Label runat="server" text='<%# (DataBinder.Eval(Container.DataItem,"schStartTime")) %>' id="DateLabel"></asp:Label> </ItemTemplate> </asp:TemplateColumn> How can I modify the code so that it display the datetime like it: (a) 2 Jun; and (b) 01:00? Thank you
-
Dear everyone, I am someone not very familiar with the public/protected/private concept. Especially to write a function to call another function inside a separated webform. Here is my problem: I have a webform A, when a button is clicked, windowB with webform B pop-up. After make some update in webform B, user click the button in webform B. Then, webform A will run a function (not reload), window B will close at the same time. If it is just to reload the webform A, it is easy to accompulish by Javascript. However, I need to run a aspx function. Is it possible? How to do it? Can you write me some demo code? Thank you very much. :)
-
Ido, thanks for your idea. I have spent some more hours to try and finally figure out the bug.... I rebind the datagrid every time page_load. Therefore everytime the dropdownlist changed, and submit, the datagrid bind old data again.... It's really stupid =P Thank you for you help anyway!
-
Thanks for your suggestion. It is easier than I think. =D
-
Thanks Ido for your kindly help. After several hours of testing, I believe I have made nothing wrong with building out the dropdownlist EXCEPT I cannot catch the new selection of user. Let's say we have a dropdownlist with choices (A,B,C,D) and the oringinal value we dataset is A. I have write a function that whatever item I updated will have a "@@@" mark after it. E.g. A => A@@@ When the user click editcommand, the label A become a dropdownlist with A,B,C,D while A is highlighted. Then, user click D and then click the updatecommand. After then, the row I changed have update from A towards A@@@. That means the function completely cannot get the latest viewstate! Also, the same result occur for all column and item using Textbox! The function completely cannot get the latest viewstate. Any idea is helpful! Thank you!
-
Hi guys, thank you for reading. I have a page which have a function to request.querystring("sth") the previous page's form. However, due to the program logic, sometimes the previous page do not give out any querystring. Therefore, if I go on the request.querystring("sth"), a nullreference error occur. Is there any method to know request.querystring("sth") is null or not? Also, the same problem also occur for the session. I don't know if there are any method to know Session("sth") is null or not. Thanks.
-
Thank you for your reply, I see not much difference between your and my structure. May I see the code of "GetDataSet" and "GetSelectedIndex"?
-
here is the html side Here is the html side coding for you reference. Thank you very much. I have already search for some sample code on Internet. I still don't know what I have missed. <asp:datagrid id="editSchDG" runat="server" DataKeyField="schId" AutoGenerateColumns="False" OnUpdateCommand="update_ScheduleEditItem" OnCancelCommand="cancel_ScheduleEditItem" OnEditCommand="edit_ScheduleEditItem"> <Columns> <asp:BoundColumn DataField="schId" ReadOnly="True" HeaderText="Schedule ID"></asp:BoundColumn> <asp:BoundColumn DataField="cId" HeaderText="Client ID"></asp:BoundColumn> <asp:TemplateColumn HeaderText="Helper Name"> <ItemTemplate> <asp:Label runat="server" text='<%# DataBinder.Eval(Container.DataItem,"hName") %>' ID="hNameLabel"> </asp:Label> </ItemTemplate> <EditItemTemplate> <asp:DropDownList ID="hNameDropList" runat="server" DataSource="<%# GethNameList() %>" DataTextField="hName" DataValueField="hId" EnableViewState=True SelectedIndex='<%# GethIdIndex(DataBinder.Eval(Container.DataItem, "hId")) %>'> </asp:DropDownList> </EditItemTemplate> </asp:TemplateColumn> <asp:BoundColumn DataField="schNote" HeaderText="Note"></asp:BoundColumn> <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="update" HeaderText="edit column" CancelText="cancel" EditText="edit"></asp:EditCommandColumn> </Columns> </asp:datagrid>
-
I have successful generate a dropdownlist inside a datagrid's template edit item. But I don't know why whatever I select in the dropdownlist, it return the result same as before (That means no change at all). I have already spent 3 days and night in it.... Thank you a lot. Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim DS As New DataSet If Not IsPostBack Then loadDStoSession() Else Response.Write("Old session") End If DS = Session("scheduleDS") BindGridtoSource() End Sub Sub loadDStoSession() Response.Write("Session cleared!") Dim DS As New DataSet Dim schtable As New DataTable Dim StartDay, EndDay As Date StartDay = #7/6/2004# Dim ConnStr As String = ("Persist Security Info=False; Data Source=localhost; Initial Catalog=SSS; User ID=sa; Password=pwd;") Dim Conn As New SqlConnection Conn.ConnectionString = ConnStr Dim objAdapter As New SqlDataAdapter objAdapter.SelectCommand = New SqlCommand("Schedule3Query", Conn) objAdapter.SelectCommand.CommandType = CommandType.StoredProcedure objAdapter.SelectCommand.Parameters.Add(New SqlParameter("@StartDay", SqlDbType.SmallDateTime)) ' The store procedure return 3 tables: 1st is a VIEW, 2nd is a TABLE carrying 'the choice for the dropdownlist, 3rd is the TABLE which the View created 'from. objAdapter.SelectCommand.Parameters("@StartDay").Value = StartDay Dim objCB As SqlCommandBuilder = New SqlCommandBuilder(objAdapter) objAdapter.Fill(DS) Dim DV As DataView = New DataView(DS.Tables(0)) Session.Add("scheduleDS", DS) Session.Add("scheduleDV", DV) End Sub Sub BindGridtoSource() Dim DS As New DataSet DS = Session("scheduleDS") Dim DV As DataView = New DataView(DS.Tables(0)) editSchDG.DataSource = DV editSchDG.DataBind() End Sub Sub edit_ScheduleEditItem(ByVal sender As Object, ByVal e As DataGridCommandEventArgs) editSchDG.EditItemIndex = e.Item.ItemIndex BindGridtoSource() End Sub Sub cancel_ScheduleEditItem(ByVal sender As Object, ByVal e As DataGridCommandEventArgs) editSchDG.EditItemIndex = -1 BindGridtoSource() End Sub Sub update_ScheduleEditItem(ByVal sender As Object, ByVal e As DataGridCommandEventArgs) Dim hNameDropList As New DropDownList Dim Note As TextBox Dim hId, i As Integer hNameDropList = e.Item.FindControl("hNameDropList") Note = e.Item.Cells(3).Controls(0) hId = hNameDropList.SelectedValue Dim schId As Integer = editSchDG.DataKeys(e.Item.ItemIndex) Response.Write("<BR>hId = " & hId) Response.Write("<BR>schId = " & schId) Response.Write("<BR>Note = " & Note.Text) Dim DS As New DataSet Dim Dt As New DataTable DS = Session("scheduleDS") Dt = DS.Tables(2) Dim DV As New DataView(Dt) DV.AllowEdit = True DV.AllowNew = True DV.AllowDelete = True With DV .RowFilter = "schId =" & schId End With For i = 0 To DV.Count - 1 DV(i).Item("hId") = hId Next Session.Add("scheduleDV", DV) Session.Add("scheduleDS", DS) editSchDG.EditItemIndex = -1 BindGridtoSource() End Sub Function GethNameList() Dim TempDataView As New DataView Dim DS As New DataSet Dim Dt As New DataTable DS = Session("scheduleDS") TempDataView = DS.Tables(1).DefaultView Return TempDataView End Function Function GethIdIndex(ByVal hId As Integer) Dim i As Integer Dim DS As DataSet DS = Session("scheduleDS") Dim Dt As New DataTable Dt = DS.Tables(1) For i = 0 To Dt.DefaultView.Count - 1 If Dt.DefaultView(i).Item("hId") = hId Then Return i End If Next Return 0 End Function
-
some suggestion from newbie If you want a new set of column everytime user reload the page. Use the clear function followed by the re-create column scripts. About the 2nd question do you mean sorting? How about put a button and the heading to call a function sort the column and then re-create and display?
-
sadly sadly the source code pages do not show source code anymore.... :(
-
Can I ask how should I rewrite the part "MyBase"? What is it define as?
-
Well... I tried and success. However, when the code come to client side, I left a open tab: <script language=.....> towards the code. Therefore all the HTML code after the open tab lost their function. They cannot be seen in Internet explorer.
-
Beginning Dynamic Websites with ASP.NET Web Matrix Author: Colt Kwong, Dave Sussman, Alex Homer, John West, James Greenwood Publisher: Wrox Press Inc Publication Date: 15/1/2003 I am a poor staff in a poor company :rolleyes: Now I am developing a medium size (for about 30-60 users, including accountant/human resource manager/low level manager) web service for my company. I only have my dreamweaver studio, web matrix and notepad to develop the system. :p However, after I read some threads in xtreme and other website, I found my coding is quite "unprofessional" (e.g. I write all the sub procedure in ONE aspx... of course no code behind, private and public class, just like writing a html...) As a self-learner, I lack of experience of writing professional code and make good-use of development tools. Recently I win a book coupon which good enough to buy a book to refer to. So that I search on web for books and I found this book. Could you mind share me some of experience of this book, or introduce me some other usual book? Thank you very much. Any idea with be helpful. :)
-
Thanks Thank you. When I add following, the javascript runs well.... but because lack of close tab: "</script>" All the html code after this tab become invalid and lost. However, when I type the code like that: Page.RegisterStartupScript("alertScript","<script language=javascript src=AlertScript.js></script>")It makes error... is it any escape character for the </script> ?
-
sigh oh... It's really bad news to me using Dreamweaver only... how come Visual Studio is so so expensive? :mad:
-
What I want to do is what this Xtreme board apply. When we mouseover the Title of the discuss board, a pop-up-text box will appear and show the general detail of the discuss thread. How to make it? Also, can the duration be longer? Thanks a lot.
-
Because I want to apply some Javascript function I found on web, I use RegisterStartupScript. The following is place at the first sentence of Page_Load: Page.RegisterStartupScript("PopUpTextScript","<script language=javascript src='PopUpText.js'>")However, when the aspx is run, the <script language=....></script> tab is stand at the last position of <form></form> tab. It makes the Javascript do not run correctly. How to correct it? Thank you.
-
to update the Database with dataview?
legendgod replied to legendgod's topic in Database / XML / Reporting
-
to put a variable in a Sql statement more clever way..
legendgod replied to legendgod's topic in Database / XML / Reporting
I am using SQL server. I will try your suggestion, thank you. -
Hello friends. Thank you for your suggestion in my previous questions. In order to query some result out of DB inside a time period, I typed this code: Dim strSQL As String = "Select * From ScheduleView where schStartTime between '" strSQL = strSQL & StartDay strSQL = strSQL & "' and '" strSQL = strSQL & EndDay strSQL = strSQL & "' order by hId,schStartTime ; Select * From HomeHelper order by hId" which "StartDay" & "EndDay" is 2 DateTime variable. Although it works well for my program... I think there must be some more clever way to do it out. If the way do exist please give me some idea. Thank you.
-
to update the Database with dataview?
legendgod replied to legendgod's topic in Database / XML / Reporting
Finally I have used commandbuilder to do the same thing. However, I would like to try your suggestion later. Thank you! -
some ppl said that we can update the database with dataview directly, so I typed the follwoing codes: Dim dv as new dataview Dim olddv as new dataview olddv = session("dv") ' which I have update it and sort it in other procedure and add it in session for i = 0 to olddv.count-1 dv.AllowEdit = True dv(i).BeginEdit dv(i)("FirstName") = olddv(i)("FirstName") dv(i)("LastName") = olddv(i)("LastName") dv(i).EndEdit next But after running, although no error message it gives no change to database. All updated still appear in session only. Have I type anything wrong? Or I have misunderstand the concept? Thank you.
-
Except makeing a ' before each sentence one by one, how to make a group of code inside aspx become "comment"? I have tried /@ /! etc.... Thankyou.
-
I got it. Thanks a lot.