I am designing a user control in ASP.NET where in i have a Textbox and onfoucus javascript event i am showing a checkbox list below and onBlur event i am hiding the checkbox list control
Now the problem is when i focus the textbox the Checkbox is visible and when i try to go and check the items it is getting hidden as onBlur event is called.
How can i avoid this any other way for this basically like a dropdown list....
Don't hide it in the onblur event.
Imitate what a real dropdown list does: it only goes away when either [a] you click an item in the list [b] some other page element is clicked.
Try hiding the checkbox on the click event (of checkbox).
Related
I have a project with a drop down and a button to refresh page.
I want to refresh page by selecting item from drop down list without using button to reload query.
You can use the drop down list's OnSelectedIndexChanged event to check the selected value and call the buttonclick event of the refresh button
You can use AutoPostback = true in the details of the dropdown. When the OnSelectedIndexChanged gets fired the page automatically reloads.
In grid row command event I am calling a .ascx page as a popup.
In the popup I have one button, on clicking the button, I'm calling one more popup.
Under the second popup I have four dropdown controls, in the dropdown controls I'm filtering and filling the data one after another.
The problem here is, if I filter the third dropdown, the second dropdown field data is getting reset(Onselectedindexchanged is firing).
You might be reloading/binding the drop downs on post back. You may want to change it to something like this
if(!Page.IsPostback)
{
//load the dropdowns the first time.
}
I have an ajax control toolkit modal popup on my page and in that modal popup i have a gridview on which user select some item through checkbox on each row of gridview. Whenever user check or uncheck on checkbox my modal popup automatically hide. I have set autopost property of checkbox set to true becuase im perporfing some calculation on each checkchanged event. what may be the problem
Your page is posting back because of the autopostback="true" on the checkbox, thus hiding the modal popup.
Look up 'ASP.Net Page Lifecycle' for further understandinf. It is important to know how this works.
I'm sure you'd also like to know how to solve this.
You could:
Set AutoWireUp=false on the page, but then you'd have to wire all events on the page manually. Since you aren't familiar with the Page Lifecycle, I'm not sure how successful you'd be.
Use a javascript-only modal popup.
Perhaps an UpdatePanel can be used.
We have a Datalist in which we have some data, with every Item we have a button control. What I want to achieve is that on the button click, the data related to that particular row of Datalist is fetched whose Button control is clicked. How to accomplish this? The problem is how to attach the button control with values related in that particular row? Note that I am using ArrayList as the Datasource since I am enabling padding via pageDataSource class...
Implement the OnDataBinding event for the Button. Then in the Button set the CommandArgument to something that will identify the row you are clicking. Then implement the OnItemCommand event for the DataList. You will be able to read the CommandArgument for the Button that was clicked and then perform whatever action you need.
I am trying to get an ASP.NET 3.5 ListView control to select and highlight lines through checkboxes displayed in the first column. If I use an asp:LinkButton instead of a checkbox, the line selection is supported automatically through the LinkButton's property CommandName="Select". How do I do that with the checkbox?
And as soon as I managed to do that, how do I get the selected items on pressing a submit button on the form ?
I'm not sure if I'm following what you're trying to achieve, do you want a visual change when you check the checkbox? If so the best option would be using jQuery and attach to the onchange event of the checkbox.
Then when you postback the form you can itterate through the items within the ListView and locate the checkbox, check its checked state and then do what you want:
foreach(var item in listView1.Items){
var checkbox = (CheckBox)item.FindControl("checkBox1");
if(checkbox.Checked) // do stuff
}