Hi i am doing a portfolio site for myself, and therefore want do display for the users of the site, what i have 'Coded' and what i have 'Designed'. For that i have two checkboxes in my backend, and what i need is, that when a box is checked it should Eval an image from the database (From my 'Create site' to my 'Show site').
asp:CheckBox ID="CheckBoxCoded" runat="server"
here is my very simple checkbox from the create site, but how should the codebehind look? should i use a bool or what? I am very sorry for my lack of experience, and i hope the question is understandable, and that someone can help me.
You can handle the Checkbox events with a checkbox handler in the codebehind, something like this:
Private Sub CheckBoxCoded_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles CheckBoxCoded.CheckedChanged
....
End Sub
Related
Situation:
I have created a custom webusercontrol. The user control is fully created in code .
It consists of a radgrid and radcombox.
The radcombox is filled with database tables, when the user select a table the data
needs to be shown in the radgrid.
This usercontrol is added to a aspx page. Everything works perfectly.
Here comes the problem:
I want a radajaxloadingpanel to be shown on the radgrid while it rebinds, using a radajaxmanagerproxy control. This doesn't work until I hit the refresh button or a page next or prev of the radgrid. Then everything works fine.
I know the combobox works because the data does change only the loadingpanel isn't shown.
Does anybody have a clue on how to solve this, a work around or a suggestion I can look into?
Finally got it to work. I did something wrong in the creation life cicle:
now i have it like this. And it works ;)
public class CustumControl
implements CompositeControl
Private RadAjaxLoadingPanel1 As New RadAjaxLoadingPanel
Private RadAjaxManagerProxy1 As New RadAjaxManagerProxy
....
Protected Sub Control_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Me.Controls.Add(RadAjaxLoadingPanel1)
Me.Controls.Add(RadAjaxManagerProxy1)
With RadAjaxManagerProxy1.AjaxSettings
.AddAjaxSetting(...)
End with
End Sub
....
Protected Overrides Sub CreateChildControls()
'Set properties controls and add themwill
End Sub
end class
Hope this will help other people with simular problems.
grtz Yuri
I know the title is vague, so I'll fully explain here my problem..
So, I'm running VB.net 3.5. I have a dynamic list of server names, and I want to put them in a CheckBoxList. The list is populated and, using that same list, I make a graph of the performance for each server listed. I want to be able to check and uncheck the checkboxes representing servers and, when I lick an update button, it'll create a new graph and graph only the servers that are still checked. I noticed that the page still loads before the button click is handled, so the CheckBoxList will repopulate itself before being able to read the current CheckBoxList. Does anybody have any input on this?
This is my load. And I populate my checkboxlist inside ShowView()
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
If _myQSVar.Count = 0 Then
Calendar1.SelectedDate = Date.Now.Date.AddMonths(-6)
Calendar2.SelectedDate = Date.Now.Date
End If
tbFromDate.Text = Calendar1.SelectedDate.ToShortDateString()
tbToDate.Text = Calendar2.SelectedDate.ToShortDateString()
lstControls = New List(Of System.Web.UI.Control)
ShowView()
End If
End Sub
I load my checkboxlist with a simple for loop
For each one As String in ServerList
chkboxList.Items.Add(one)
Next
And I wanna try to preserve the checkboxlist values when I do an event handler for an update button.
Private Sub btnUpdateGraph_Click(sender As Object, e As System.EventArgs) Handles btnUpdateGraph.Click
'insert code
End Sub
Are you populating the checkboxlist on form.load? If so make sure you checking for if Page.ispostback. Load the checkboxlist only if its not a postback. This will make sure the page(and the checkboxlist) is not reloaded when you click.
Also, please do not lick update buttons. They dont really like that!
I believe you are binding CheckboxList at PageLoad Event. Just place the code inside the given code block:
if(!IsPostback)
{
// Bind your Checkbox List here
}
This will bind your checkboxlist only in case if the page loads first time, not after any postback.
I hope this will help you out.
So i have a form and one of the fields may include one item or may require more fields to be created immediately to accommodate the extra input. so something like below:
FieldName:------ +
The plus sign would be clicked to get another field:
FieldName:------ +
FieldName2:------ +
.... so on
Sorry for poor illustration. I am looking to do this in an asp.net page. any idea how? need ajax component?
Thanks,
EDIT:
Protected Sub Button1_Click( ByVal sender As Object , ByVal e As System.EventArgs) _
Handles Button1.Click
Dim t As TextBox
t = New TextBox
PlaceHolder1.Controls.Add(t)
End Sub
This code would add one textfield. But if I want to add more, i am unable to do so...
You could create a Placeholder control and onclick (postback) of the '+' button add a new control (e.g. Textbox) to the Controls collection of the Placeholder.
You would need to remember to re-add any controls to the placeholder upon subsequent postbacks (within the OnInit() preferably). This is so that previously added controls and their values can be retained.
I am completely new to Asp.net.
I am currently working on a asp.net page coded via Visual Basic
On the page I have these image buttons that are dynamically generated based on the SQL Data the page retrieves.
Unfortunately I could not figure out how to bind a click function to each of these buttons.
the [Control Name].onClick = "Function Name()" is for clientSide scripts.
and I need to bind
Protected Sub Button_InsertNewTextBox_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button_InsertNewTextBox.Click
to the dynamically allocated buttons.
I couldn't figure out how.
Can anyone help?
I believe in Visual Basic the AddHandler statement is what you're after
I have a form default.aspx with a scriptmanager and webpart manager.
I have 4 webpart zones. One of the zones has a basic user control for its content. The user control has a button inside an update panel and I have the following on the click event for the button:
Protected Sub cmdMarkComplete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdMarkComplete.Click
Me.Page.ClientScript.RegisterStartupScript(Me.Page.GetType, "mymsg", "<script>alert('hello');</script>", True)
UpdatePanel1.Update()
End Sub
Nothing happens, I dont even get any javascript error but the aync does cycle as I can changes label value (as test) etc. If I check the source markup after the click, 'hello' is not even there so its as if its not registering the script. It must be todo with the fact I have an user ctrl inside a webpart. Can anyone help?
Thanks in advance.
Try using ScriptManager.RegisterStartupScript, this should provide better support, esp for scripts added in an update panel
http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.registerstartupscript.aspx