I've recently changed the rowheight for our grid and reduced it a bit (using code from http://www.devexpress.com/Support/Center/KB/p/A859.aspx).
However this breaks our RepositoryItemImageComboBox, the images are no longer shown.
Using a RepositoryItemPictureEdit with an unbound column I can't seem to find how to create a working row filter/row sort.
Who can help me either fix the RepositoryItemImageComboBox images to show again or implement a filtering/sorting RepositoryItemPictureEdit.
This is the column shown with RepositoryItemPictureEdit, No image data on the filterrow is also a problem
This is the column shown with a RepositoryItemImageComboBox.
I've added some code to handle the GridViews CustomDrawCell with no Editor specified. Since we don't really need the editor to choose but show the column read only it suffices.
Private Sub gvw_CustomDrawCell(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs) Handles Me.CustomDrawCell
e.Graphics.DrawImage(BitMap, e.Bounds);
end sub
Related
I have a gridview which takes inputs from a textbox. Multiple values can be added to it. I want to rest the grid. I have tried few codes in the internet. But just clear the grid. When i type the numbers again all the previous numbers appear. I want to remove previous numbers too when i reset the grid. How can i do it?
Here is my back end code
if (grdPolicyDetails.Rows.Count > 0)
{
grdPolicyDetails.Columns.Clear();
grdPolicyDetails.DataBind();
}
I have tried this code too. This too didn't work.
grdPolicyDetails.DataSource = null;
grdPolicyDetails.DataBind();
Are you talking about the History of Browser ? if yes then,
If Clear Gridview Data then,
grdpolicydetails.Controls.Clear();
i have created forms which use queries to manipulate and show data, these queries have [criteria] which is taken from a combo box \ text field in the form.
it runs perfectly when i execute the form alone, however when executing it from the MainNavigationForm (tabbed navigation style) it pops-up the "enter criteria" dialog that you usually get when you specify a criteria without any source - like empty brackets [].
i am posting the VB code behind both forms, both behave the same way, and pop the dialog for criteria when launching them from the main navigation form, the first form has more code because it updates the query and values in another combo box based on the value of the first combo box. the second form just runs the query again when value in the combo box is changed.
thank you for your help.
Option Compare Database
Private Sub Command23_Click()
DoCmd.OpenQuery "QryMaintProgPlan", acViewNormal
End Sub
Private Sub id_combo_AfterUpdate()
DoCmd.ShowAllRecords
DoCmd.FindRecord Me!id_combo
Me.maint_combo.Requery
Me.emp_combo.Requery
End Sub
Private Sub maint_combo_AfterUpdate()
Me.emp_combo.Requery
Me.EmployeeID = emp_combo.ItemData(0)
End Sub
2nd form :
Option Compare Database
Private Sub btn_requery_Click()
DoCmd.ShowAllRecords
End Sub
Ok, i have found the answer, i was supposed to use the adress of the navigationSubform in the query criteria because once i launched it from the navigationForm it no longer used the same adress. [Forms]![frmMainNavigation]![NavigationSubform]![id_combo] is the correct one
instead of [Forms]![frmMaintProgPlan]![id_combo].
I have autogenerated columns here from visitid and so on. The first column however was a templatefield. now I wanted to hide VisitID. I tried this code but it didn't work. I am using vb as my codebehind
e.Row.Cells(1).Visible = False
I have tried several ways but also ended with this code and it worked finally I just added a condition. I'm sorry maybe I lacked information. I had a pagination in the gridview.. Here was my working code.
Protected Sub Gdvisitor_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles Gdvisitor.RowCreated
If (e.Row.Cells.Count > 1) Then
e.Row.Cells(1).Visible = False
End If
End Sub
At first it was "....cells.count < 0" and that didn't work the index was still out of range but when I changed it to 1. It worked. I think the pagination has something to do with it. I'm not sure though... Thank you for all the help
To hide the columns you need to set visible to false for column not the cell.
gridView1.Columns(1).Visible = False
Try this ...
GridView.Columns(1).Visible = false
Try this...
gridview name.columns(column number).visible=false;
If u want to hide the 3rd column use the above code as:
gridview name.columns(3).visible=false;
Autogeneraterd grids' columns cannot be hidden. If you do a check like dg.columns.count you'll get 0 instead of 6.
Use a template column for each one or do this using jQuery.
I have a simple project with a namespace of 'Search' which contains a number of images which have been marked as embedded resources.
I've entered this into Assembly.vb after checking the reference with Reflector to ensure the image is in the assembly. I've placed the image 'whole.gif' in the root of the application.
<Assembly: System.Web.UI.WebResource("Search.whole.gif", "image/gif")>
My code to render the image is below, it should by rights render the image but doesn't and I can't for the life of me see why.
Private Sub Page_PreRender(sender As Object, e As System.EventArgs) Handles Me.PreRender
btnImgAll.ImageUrl = Page.ClientScript.GetWebResourceUrl(Me.GetType(), "Search.whole.gif")
End Sub
I found the problem reference to the type which is almost every example given I could find uses Me.GetType(). I chased every other avenue aside from checking this argument until I can across a chance remark in a forum post.
I changed the line
btnImgAll.ImageUrl = Page.ClientScript.GetWebResourceUrl(Me.GetType(), "Search.whole.gif")
to
btnImgAll.ImageUrl = Page.ClientScript.GetWebResourceUrl(GetType(Content_Modules_RegionSelector), "Search.whole.gif")
where Content_Modules_RegionSelector is the class name of the parent control, which in my case is a simple web user control.
I think this has to be THE most frustrating thing I've ever done in web forms. Yet one would think it would be the easiest of all things in the world to do. That is this:
I need 2 separate lists of radiobuttons on my .aspx page. One set allows a customer to select an option. The other set does also but for a different purpose. But only one set can have a selected radiobutton.
Ok I've tried this using 2 asp.net Radiobuttonlists controls on the same page. Got around the nasty bug with GroupName (asp.net assigns the control's uniqueID which prevents the groupname from ever working because now, 2 radiobuttonlists can't have the same groupname for all their radiobuttons because each radiobuttonlist has a different uniqueID thus the bug assigns the unique ID as the name attribute when the buttons are rendered. since the name sets are different, they are not mutually exclusive). Anyway, so I created that custom RadioButtonListcontrol and fixed that groupname problem.
But when ended up happening is when I went to put 2 instances of my new custom radiobuttonlist control on my .aspx page, all was swell until I noticed that every time I checked for radiobuttonlist1.SelectedValue or radiobuttonlist2.SelectedValue (did not matter which I was checking) the value always spit back string.empty and i was not able to figure out why (see http://forums.asp.net/t/1401117.aspx).
Ok onto the third try tonight and into the break of dawn (no sleep). I tried to instead just scrap trying to use 2 custom radiobuttonlists altogether because of that string.empty issue and try to spit out 2 sets of radiobuttonlists via using 2 asp.net repeaters and a standard input HTML tag inside. Got that working. Ok but the 2 lists still are not mutually exclusive. I can select a value in the first set of radiobuttons from repeater1 and same goes for repeater2. I cannot for the life of me get the "sets" to be mutually exclusive sets of radiobuttons.
As you have two groups of radio buttons that you want to function as one group of radio buttons, the solution is simple: Make it one group of radio buttons.
The only problem you have then is that the value that you get has the same name from both lists, but that can be solved by adding a prefix to the values so that you easily identify from which list the option comes.
Update: based on the new info posted as an answer. The option I proposed on my original answer corresponds to the 3. You really must consider the following:
Html radio buttons have only 1
built-in mechanism to handle the
exclusivity, which is the name.
You are explicitly requesting a no js solution, so given the above you must manipulate the Ids to achieve it. If you weren't blocking this option I am sure someone would come up with some nice jquery or js library that already supports it.
The option 3 is clearly the less invasive, as you are not forced to affect the actual data, and are not affected by future updates to it.
It's not that much code, just something extra on the List indexes, and some simple thing as:
int? list1Value = null;
int? list2Value = null;
var value = Request.Form["somegroup"];
if (value.StartsWith("List1"))
list1Value = int.Parse(value.Substring(5));
else
list2Value = int.Parse(value.Substring(5));//Assuming List2 as prefix
Original:
I saw your other question, and you just need to use the same group name. Make sure you have different values for all items regardless of the list they come from. A way to achieve this is adding something to the values, like: <%# "List1-" + Eval("ID") %> and modifying the code that reads your Request.Form["yourgroupname"].
I think you should just use RadioButtons instead of RadioButtonLists.
Here's an article that presents a solution to resolve the radiobutton naming bug.
Though this post is dated 1 year ago already, I just read it because I face the same problem.
Currently I have 1 solution using jQuery:
Client side script (you must also include jQuery)
function SetRadio(rb) {
$('input:checked').attr('checked', false);
rb.checked = true;
}
For every radiobutton (which is a listitem in a radiobuttonlist) I add the following on the serverside:
li.Attributes.Add("onclick", "javascript:SetRadio(this)");
For me this works in both IE and Firefox, with 3 radiobuttonlists, without using groupnames.
You can check each radiobuttonlist for a selecteditem/value, or you can extend the SetRadio function so it stores the selected value in a hidden field.
Regards,
M