But mine day render code make use of the parameter e. Private Sub calEvent_DayRender(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles calEvent.DayRender Dim yr As Integer = lblyear.Text Dim r As String 'lblmthSelect.Text = "3" Dim mth As String = lblmthSelect.Text Dim countloop As Integer = 0 Dim imgicon As System.Web.UI.WebControls.Image e.Day.IsSelectable = False If e.Day.IsOtherMonth Then e.Cell.Controls.Clear() e.Cell.Dispose() End If lblInstructions.Visible = False ' calEvent.Visible = True Dim i, j, num, k, b As Integer Dim rname As String Dim bkresource, bkInfo As DataSet Dim own As DataSet Dim txt As String Dim starting As Integer For i = 0 To cbxlistResource.Items.Count - 1 If cbxlistResource.Items(i).Selected = True Then countloop += 1 Dim number As Integer = 0 Dim row As New TableRow Dim cellleft As New TableCell Dim cellright As New TableCell Dim lblnametxt As New Label Dim divlbl As New Label rname = cbxlistResource.Items(i).Text Dim rstart As New Regex("~") Dim mstart As Match = rstart.Match(rname) If mstart.Success Then starting = mstart.Index.ToString() End If Dim totlen As Integer = rname.Length - starting Dim result As String = rname.Substring(starting, totlen) Dim totfinal As Integer = result.Length - 2 Dim finalresult As String = result.Substring(2, totfinal) Dim name As String = eresource.remove(finalresult, "(") Dim rID As String = eresource.getResourceID(name) '============= to retrieve resource owned by =============== own = eresource.getresourceownby(rID) For k = 0 To own.Tables(0).Rows.Count - 1 Dim ownccode As String = own.Tables(0).Rows(k).Item(0) Dim ownCname As String = eresource.getCNameByCC(ownccode) Dim ownDiv As String = own.Tables(0).Rows(k).Item(1) Dim resourcename As String = own.Tables(0).Rows(k).Item(2) txt = " " & ownCname
terjk
Posts
-
placeholder -
placeholderThe part on creating the dynamic button on page postback. The day_render is an event unlike the createcalendar() where i can place it anywhere. day_render require parameter
-
placeholderThe DayRender event. The imagebuttons are created in this event. So what can i do so i can call this on isPostBack. Like what I have before is the createcalendar() which can be apply to postback and creating the calendar on first load.
-
imagebutton onclickPrivate Sub calEvent_DayRender(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles calEvent.DayRender e.Day.IsSelectable = False If e.Day.IsOtherMonth Then e.Cell.Controls.Clear() e.Cell.Dispose() End If For i = 0 To cbxlistResource.Items.Count - 1 If cbxlistResource.Items(i).Selected = True Then Dim img As New ImageButton 'img = New ImageButton Dim lblline As New Label AddHandler img.Click, AddressOf ImageClickHandler If e.Day.IsOtherMonth Then e.Cell.Controls.Clear() lblnametxt.Visible = False img.Visible = False lblline.Visible = False Else img.ImageUrl = Server.MapPath("Pics\pencil.gif") lblnametxt.Visible = True img.Visible = True lblline.Visible = True 'If Not e.Day.Date < Date.Today Then e.Cell.Controls.Add(lblnametxt) 'End If End If
This is the code i did in the dayrender method. I make used of the 'e' parameter that is pass in. If i were to create a new method, what about the e parameter that was passed in? -
placeholderIf Not Session("ButtonCreated") Is Nothing Then buttoncreated = CType(Session("ButtonCreated"), Boolean) Else buttoncreated = False End If If IsPostBack And buttoncreated Then ' calEvent_DayRender() ' createcalendar() End If
How can i apply this to monthly calendar? i make sure of the calendar control method-dayrender. I cant possible just code the sub just like what i did for the other calendar -createcalendar() -
imagebutton onclickOKAY! I understand... thanks However, I still have another problem. I'm using dynamic imagebuttons. Therefore there is a need to intantiate the imagebutton on page_load on post back, right? I have a monthly calendar and made use of the method day_render. This is where i created my imagebutton (for the 1st round) . The problem then come... how can i intantiate the button again on postback? Private sub page_load(..) cal_dayrender() end sub ?? i cant possibly pass the subroutine in like this right?
-
imagebutton onclickOkie... never mind about that. Like what you have told me, for dynamic controls is got to instantiate them in the page_load, right? Well, i have 3 event calendars-- daily, weekly & monthly. For daily and weekly everything works fine because i created the calendar using html table whereby i have a subroutine and i jus apply the method to the pageload when post back. However, for the monthly calendar, im using calendar control provided. Therefore, i got to use the method provided called DayRender. I can't possibly pass the dayrendar() into pageload, right? As you know the purpose of dayrender method. i can't just apply it to pageload as a sub routine. This is the error message i get Arguement not specified for a parameter 'e' of Private sub calevent_dayrender(sender as object, e as system.web.ui.webcontrols.dayrendereventargs)
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not Session("ButtonCreated") Is Nothing Then buttoncreated = CType(Session("ButtonCreated"), Boolean) Else buttoncreated = False End If If IsPostBack And buttoncreated Then ' calEvent_DayRender() End If
Private Sub calEvent_DayRender(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles calEvent.DayRender Dim img As New ImageButton AddHandler img.Click, AddressOf ImageClickHandler If e.Day.IsOtherMonth Then e.Cell.Controls.Clear() lblnametxt.Visible = False img.Visible = False lblline.Visible = False Else img.ImageUrl = Server.MapPath("Pics\pencil.gif") lblnametxt.Visible = True img.Visible = True lblline.Visible = True End If If isClose then If e.Day.Date > Date.Today Or e.Day.Date = Date.Today Then e.Cell.Controls.Add(img) buttoncreated = True Session("ButtonCreated") = buttoncreated End If
Hope you understand....This is where i created mine buttons -
imagebutton onclickU mean i really can't continue if i were to use imagebutton?
-
imagebutton onclickBut there isn't any suitable properties which i can use. sender.gettype??? How to check it's ID property?? At the button.clicked method??
-
imagebutton onclickprivate void ibDatePick_Click(object sender, System.Web.UI.ImageClickEventArgs e) { string parmCnt = ( (ImageButton) sender ).CommandArgument; } (ImageButton) is the name of mine button? But it doesn't have the properties .commandarguement. Only .gettype Does this is to asp.net syntax too? Or i have to inherits or imports something? Must I have any additional codes to the imagebutton (upon creating the button)? So I can apply the commandname or commandarguement(which is i can't in asp.net properties)? I have tried e.gettype, e. etc... but jus couldn't find the properties you mentioned.
-
placeholderWhat is the cause for this error? I have assigned a unique ID to each controls. An error has occurred because a control with auto-generated id '_ctl26' could not be located to raise a postback event. To avoid this error, explicitly set the ID property of controls that raise postback events. How i can get the value of which iamgebutton is click. i need to pass the value to another form when click.
-
imagebutton onclickI have imagebuttons which are created dynamically. Upon click, do a response.redirect and carry the value of the clicked imagebutton to another form. But how can i check which button is being clicked? I have assigned a unique id to each button.
Private sub createcalendar() ElseIf tobook Then imgholi = New ImageButton imgholi.ID = rID imgId = imgholi.ID Session.Add("ResourceLevel", imgId) imgholi.ImageUrl = Server.MapPath("Pics\pencil.gif") AddHandler imgholi.Click, AddressOf ImageClickHandler cellleft.Controls.Add(imgholi) buttoncreated = True Session("ButtonCreated") = buttoncreated
(There are many creating of new imagebutton)Public Sub ImageClickHandler(ByVal sender As Object, ByVal e As ImageClickEventArgs) Response.Redirect("MyBookingNewBooking.aspx?ResourceID=" & id & "BookingDate=" & dateformat) End Sub
There is no properties as .clicked..What should i do? -
imagebutton click handleri Guess the main problem is the ID. But there is no way i can set it. I have look through the properties. There is a UNIQUEID. img.uniqueid=resourceid the uniqueid returns me _ct20 and others other. (similar to this) really need your help.... I have no idea if the problem lies in the computer or me. When i addhandler and a click eventhandler, with a breakpoint there and run the program. But when i click on the button, it doesnt step into the sub routine but it still can bring me to where i want. WHY? :~ :confused:
-
imagebutton click handlerI couldn't the a unique value for each dynamic control. I used the same method lile the one you gave. img.id=resourceid But why is it that i can get the value of resourceid. But img.id is NOTHNG.
-
imagebutton click handlerOh My God! There is FIND to search for _ctl4'. In return they say cannot find _ctl4' What should i do now? If i were to recreate the controls in page back, but why is it at the 2nd page load, the sub routine is stepped in twice. (subroutine is the creating of dynamic controls)
-
imagebutton click handlerBIG BIG PROBLEM! Any idea what error is this? An error has occurred because a control with auto-generated id '_ctl4' could not be located to raise a postback event. To avoid this error, explicitly set the ID property of controls that raise postback events. When the page is loaded the first time, everything is fine. However, when i click next, to show other day of the event calendar, It create TWO calendars instead of 1. Why is this so?
Dim buttoncreated As Boolean = CType(Session("ButtonCreated"), Boolean) If IsPostBack Then If Not buttoncreated Then createCalendar() End If End If Session("ButtonCreated") = buttoncreated (in page load)
Public Sub createCalendar() If Not statuscheck = 0 Then Dim img As New ImageButton img.ID = rid Session.Add("ButtonClick", imgResource) AddHandler img.Click, AddressOf ImageClickHandler img.ImageUrl = Server.MapPath("Pics\pencil.gif") cellleft.Controls.Add(img) row.Controls.Add(cellleft) buttoncreated = True Session("ButtonCreated") = buttoncreated
createcalendar() is called each time user click on BUTTON GO. -
placeholderBIG BIG PROBLEM! Any idea what error is this? An error has occurred because a control with auto-generated id '_ctl4' could not be located to raise a postback event. To avoid this error, explicitly set the ID property of controls that raise postback events. When the page is loaded the first time, everything is fine. However, when i click next, to show other day of the event calendar, It create TWO calendars instead of 1. Why is this so?
Dim buttoncreated As Boolean = CType(Session("ButtonCreated"), Boolean) If IsPostBack Then If Not buttoncreated Then createCalendar() End If End If Session("ButtonCreated") = buttoncreated (in page load)
Public Sub createCalendar() If Not statuscheck = 0 Then Dim img As New ImageButton img.ID = rid Session.Add("ButtonClick", imgResource) AddHandler img.Click, AddressOf ImageClickHandler img.ImageUrl = Server.MapPath("Pics\pencil.gif") cellleft.Controls.Add(img) row.Controls.Add(cellleft) buttoncreated = True Session("ButtonCreated") = buttoncreated
createcalendar() is called each time user click on BUTTON GO. -
placeholderBIG BIG PROBLEM! Any idea what error is this? An error has occurred because a control with auto-generated id '_ctl4' could not be located to raise a postback event. To avoid this error, explicitly set the ID property of controls that raise postback events. When the page is loaded the first time, everything is fine. However, when i click next, to show other day of the event calendar, It create TWO calendars instead of 1. Why is this so?
Dim buttoncreated As Boolean = CType(Session("ButtonCreated"), Boolean) If IsPostBack Then If Not buttoncreated Then createCalendar() End If End If Session("ButtonCreated") = buttoncreated (in page load)
Public Sub createCalendar() If Not statuscheck = 0 Then Dim img As New ImageButton img.ID = rid Session.Add("ButtonClick", imgResource) AddHandler img.Click, AddressOf ImageClickHandler img.ImageUrl = Server.MapPath("Pics\pencil.gif") cellleft.Controls.Add(img) row.Controls.Add(cellleft) buttoncreated = True Session("ButtonCreated") = buttoncreated
createcalendar() is called each time user click on BUTTON GO. -
placeholderNow I can leave out the dynamic checkboxes. Will be using checkboxlist instead (which can wotk with the dynamic imagebutton the previous time), so i guess this wouldn't be much of a problem as compare to the dynamic checkbox, am i right? However, I got to run the weekly form before i can click the button of the daily?
Page load If Not Session("ButtonCreated") Is Nothing Then buttoncreated = CType(Session("ButtonCreated"), Boolean) Else buttoncreated = False End If If IsPostBack And buttoncreated Then createCalendar() End If private sub createcalendar() imgholi.ID = rid imgholi.ImageUrl = Server.MapPath("Pics\pencil.gif") AddHandler imgholi.Click, AddressOf ImageClickHandler cellleft.Controls.Add(imgholi) buttoncreated = True Session("ButtonCreated") = buttoncreated
i have 3 calendars(Daily, weekly, monthly). If i were to select the daily calendar and click on the imagebtn, the table refreshes unless i select the weekly calendar and click the imgbtn. why? -
imagebutton click handlerOr i can't create 2 different dynamic button on pageload?