Forms Data Controls :: Evaluating Boolean Column In DataGrid
Mar 2, 2010
I have a boolean column in a datagrid that I would like to display as red/green image (I have already created these) instead of false/true. Or maybe I could display the "True" in green text and "False" in red text. Can someone point me in the right direction?
View 2 Replies
Similar Messages:
Dec 10, 2010
I have an asp:label field for and expire date that should either display "Never" if the database field ([msDS-UserDontExpirePassword] this is a bit - true/false - field) is True, or otherwise display a date (pwdExpireDate).
My code doesn't throw any errors but I can' fully test it without putting it into production. Can someone tell me if this is correct? Also, there is no code-behind and I can't use code behind for this.
Here's the code:
The label: <asp:Label ID="lbUserPWExpireDate" Text='<%# ((bool)(Eval("[msDS-UserDontExpirePassword]"))==true ? "Never" : Eval("pwdExpireDate", "{0:M/dd/yyyy}")) %>' Runat="Server"/>
The query: <asp:SqlDataSource ID="GetUserExpireDate" runat="server" ConnectionString="<%$ ConnectionStrings:USER_PREFERENCESConnectionString %>" SelectCommand="SELECT DATEADD(day, 59, pwdLastSetDateGMT) AS pwdExpireDate, [msDS-UserDontExpirePassword] FROM LDAP_Users WHERE mail = @USER_EMAIL_ADDRESS" OnSelecting="GetUserExpireDate_Selecting"> <SelectParameters> <asp:SessionParameter Name="USER_EMAIL_ADDRESS" SessionField="USER_EMAIL_ADDRESS" /> </SelectParameters></asp:SqlDataSource>
View 3 Replies
May 11, 2010
I have a datagrid control, the first column is Revno, currently presenting info in linkbutton. i want to do a condition based on another field docid, which gets true or false value from database. if true then present Revno in linkbutton otherwise show the revbnno just as a label., thatway users does'nt have ability to clickit.
<ItemTemplate>
<asp:LinkButton ID="lblRevision" runat="server" CssClass="Textboxes" Text='<%# DataBinder.Eval(Container.DataItem, "RevNo")%>' CommandName="FileDownloadRecord"></asp:LinkButton>
</ItemTemplate>
this docid field has flag true or false.
if true meaning show the revno as LinkButton, otherwise show the revno as label.
GetDocdetail(DataBinder.Eval(Container.DataItem, "Docid")
on the codebehind side i can use this function.
Public Function GetDocdetail(ByVal DocID As boolean) As String
If DocID = "true" Then
Else
End If
End Function
View 4 Replies
Jan 24, 2011
In trying to improve 'user experience' with a GridView, I have an administrative application where a GridView is displaying records from a SQL table. One of the columns is a bit column, and is displayed as a checkbox in the GridView. I want the user to be able to simply check or uncheck the box while viewing the GridView, and the value in that column for that record is immediately updated. So I set AutoPostBack="true" on the CheckBox in the GridView's Template Field.
But tests are indicating that the column value is not actually getting changed, even though the page appears to post back and displays the newly checked (or unchecked) checkbox correctly. But if I check the SQL table directly the column's value has not changed.
View 5 Replies
Mar 20, 2010
I have defined some binary bit columns in an SQL database table to indicate yes/no conditions, but I don't know how to set or reset them. I tried to use "profile.Volunteer = 0;" C# code in an event handler to reset a voluntary state for the Profile table of members, but what I got back was an error message that said, "Constant value '0' cannot be converted to a bool'. So, if a '0' cannot be used to reset a boolean value, what can be used?
View 2 Replies
Sep 30, 2010
I have "Order" object with Columns Ticket,OTP and CustomerName etc.Intially on DataGrid, I'm binding Ticket only , when user clicks on "Column Chooser" button, another windows appears to pickup CustomerName,OTP columns to add specified column dynamically on Datagrid. Environment : Asp.net ,C# with Object Data source
Public Class Order
{
publc void Order()
{
}
public string Ticket
{
get
{
return this.strTicket;
}
set
{
this.strTicket = value;
}
}
public string OtpNumber
{
get
{
return this.strOtpNumber;
}
set
{
this.strOtpNumber = value;
}
}
public string CustomerName
{
get
{
return this.strCustomer;
}
set
{
this.strCustomer = value;
}
}
}
}
View 1 Replies
Mar 25, 2011
I have a datagrid which I only want the maintenance column to be editable (the other fields are only editable to admins at a different web page)
I've only just started messing with asp/SQL and would be very grateful for the help :)
Below is my code. I have tried messing with the update queries and it seems to mess up everytime some way or another. I'v
[Code]....
View 3 Replies
Feb 4, 2011
I've got a typed dataset that populates programmatically based upon dropdown selections from the user, and then is bound to a datagrid. One of the cols is a bit type (indicating whether or not that record is "active"). I would like that datagrid col to be exposed to the user as a bunch of checkboxes, which the user could turn on and off as needed, and then update the entire recordset according upon clicking Submit.
Is converting a dg column into checkboxes a straightforward thing to do?
View 3 Replies
Oct 27, 2010
how to sort DataGrid column. (Say like FirstName) I have done snippet like: (see Bold text) For HTML :
<asp:DataGrid ID="dtgCustomerSearch" runat="server" AllowSorting="true">
<Columns>
<asp:BoundColumn HeaderText="CustomerID" DataField="CustomerID" />
<asp:BoundColumn HeaderText="First Name" DataField="FirstName"
SortExpression="FirstName" />
<asp:BoundColumn HeaderText="Last Name" DataField="LastName"
SortExpression="LastName" />
<asp:BoundColumn HeaderText="Phone No." DataField="Phone" />
<asp:BoundColumn HeaderText="Email ID" DataField="EmailID" />
</Columns>
</asp:DataGrid>
On Page_load I have wrote: this.dtgCustomerSearch.SortCommand += new DataGridSortCommandEventHandler(dtgCustomerSearch_SortCommand);
private void dtgCustomerSearch_SortCommand(object source, System.Web.UI.WebControls.DataGridSortCommandEventArgs e)
{
SortExpression = e.SortExpression;
BindTheGrid();
}
string SortExpression
{
set
{
if (ViewState["SortExp"] == null || value != ViewState["SortExp"].ToString())
{
ViewState["SortExp"] = value;
}
else
{
ViewState["SortExp"] = value + " DESC";
}
}
get
{
return ViewState["SortExp"] == null ? string.Empty : ViewState["SortExp"].ToString();
}
}
View 5 Replies
Apr 15, 2010
I have a datagrid that is supposed to display the list of uploaded word doc containing a specific word , this sort by the one having the greatest number of occurences(relevance).
It should allow the user to download one of the file by clicking on the button column .But im unable to get the text appearing in the datagrid nor the one in the button column
these are the table column
Firstname,Lastname,Path and Relevance
This is the code on item command:
[Code]....
the datagrid code:
<asp:DataGrid ID="DataGrid1" runat="server" AllowPaging="True"
BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px"
CellPadding="4" ForeColor="Black" GridLines="Vertical" ShowFooter="True"
AutoGenerateColumns="False" onitemcommand="DataGrid1_ItemCommand"
Width="353px">
<FooterStyle BackColor="#CCCC99" />
<SelectedItemStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right"
Position="TopAndBottom" />
<AlternatingItemStyle BackColor="#6699FF" Font-Bold="False" Font-Italic="False"
Font-Overline="False" Font-Strikeout="False" Font-Underline="False" />
<ItemStyle BackColor="#F7F7DE" />
<Columns>
<asp:BoundColumn DataField="firstName" HeaderText="FirstName" ReadOnly="True">
</asp:BoundColumn>
<asp:BoundColumn DataField="lastName" HeaderText="LastName" ReadOnly="True">
</asp:BoundColumn>
<asp:ButtonColumn CommandName="getCv" DataTextField="Path" HeaderText="Cv"
Text="Path"></asp:ButtonColumn>
<asp:BoundColumn DataField="NumberOfOccurences" HeaderText="Relevance">
</asp:BoundColumn>
</Columns>
<HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
</asp:DataGrid>
May i know how to get the value of the button column been click?
View 2 Replies
Aug 2, 2010
I want to autosize the last column so it spans to the full width of the datagrid. I've messed about with the width and autosize but can't seem to get it right.
**figured it out with dataGrid_customer.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
View 2 Replies
Jan 26, 2010
[Code]....
Summing a column in a datagrid
View 3 Replies
Jun 24, 2010
I had a datagrid and I was hiding columns. This was working fine to show just the columns I wanted.
[Code]....
And then I realised I wasn't paging the data so I ticked that on then above code no longer worked. The Count was equalling 1 with the paging ticked on. Why would that be?
I also used the classic formatting and when I sort the columns the classic formatting goes funny, how can reapply the sorting to make it look classic?
View 2 Replies
Jan 15, 2010
Is there a way to make a hyperlink column in datagrid on the fly... I have a search page and would like the user to be able to click a button to few full contents about the item for editing, etc.
View 11 Replies
Aug 17, 2010
I'm setting up a fairly complex gridview, and running into an issue with allowing some keyboard shortcuts to cause a submission postback. I'm hooking the onkeydown event on all of the editable elements within my gridview (in edit mode, as well as a separate-but-similar set of elements in the footer, used for row insertion), and calling the following function:
[Code]....
Here is the definition of LinkButton1, which is within a TemplateField in MasterGridView:
[Code]....
The gridview is not populated until after the user has made some input to the page, so I can't just refer directly to MasterGridView.SelectedRow.FindControl("LinkButton1").UniqueID for my eventTarget within the PostBackOptions (if I run this right now, it'll evaluate to "not initialized". But, I don't know how I could get it to recheck the value after the page has been created. There's gotta be a better way to make this work.
View 5 Replies
Nov 10, 2010
I have a datagrid with 5 columns and i m using edit and update methods over it. In the edit event it opens up all the columns in a row for editing. i need only 2 columns in tat row be editable. how can i do this.
my level of knowledge on asp.net with c# is newbie.
View 6 Replies
Oct 12, 2010
I m working on Datagrids and i am trying to specify a fixed width for a Column(in datagrid) ...Is there any property to specify the width of the columns in datagrid(i know its pretty easy to specify the width of the Datagrid but i want to specify the fixed column width) Also how do i specify the text wrapping in a datagrid
View 1 Replies
Jan 20, 2011
Is there any way to get the datagrid header column's text before the grid loads.
View 7 Replies
May 18, 2010
i am kind of new in the .net world. I would like to know how you can add a link column with an image to a datagriid.
P.S. i am using Visual studio 2005.
View 2 Replies
Oct 28, 2010
I had a datagrid with lot of columns.The datagrid coloumns width changes accoprding to data.
So I want to get the width of the column in Javascript,because I maintain a dummy header(**here I need to set the each Header column width according to the data columns width).
View 4 Replies
Dec 11, 2010
I have a datagrid, I want to merging cell. I want my datagrid look like this
Material Name
1
2
3
4
..
31
Material A
100
200
150
220
..
500
Material B
1200
4500
..
600
I want to merge the cell programmitically when ItemDataBound.
1,2,3,...,31 are material date request. If I request Material B with quantity 4500 from 2nd until 4th the cell will be merge.
I already read about Merge Cell in Gridview in this forum, but this solution is different with datagrid.
View 3 Replies
Feb 10, 2010
i have a DatagridView which contains 5 columns. The Fifth Column can contain a number or a NULL value .
I need to edit the DataGrid it in such a way that the fifth column is hidden everytime.
And on a specific condition that if fifth column is not null , then display the value which is present in fifth column ,in a small subscript below the the corresponding element in first column .
View 7 Replies
Jul 20, 2010
I have a table structure such as this:
Bank_name | Share_date | Share_Price
Skye Bank | 2010-07-19 |6.99
FCMB | 2010-07-19 |7.99
Skye Bank | 2010-07-20 | 7.79
FCMB |2010-07-20 | 7.44
What I need to do is to compare the values for the previous day to see whether it is greater than today's and then return an image in an Image templatefield in a gridview. Below is my gridview:
[Code]....
Basically, the imgUrl method should return the correct indication in the gridview image template field. For instance if the sprice(which is today's values) is greater then the previous an uparrow should appear. However, I notice that the conditions is not evaluating correctly, for instance the Bank_Name FCMB in the table still returns an uparrow even when its share price is down from the previous day value.
View 4 Replies
Apr 22, 2010
I have followed an online Microsoft tutorial that walks through building a Northwind.xsd that includes ProductsTableAdapter and a few other such table adapters (http://msdn.microsoft.com/en-us/library/aa581776.aspx).
Question: I now see a update column at the start of each row of the datagrid for AllProducts page. When I click update on a row and change the value of one of the non-primary fields (ex. Productname) and press Update, I get the following error:
The GridView 'GridView1' fired event RowUpdating which wasn't handled. How do I implement this event handler in VB? I know that when I implement using SQLConnection and use templatefields to bind each column I don't need to implement each event handler.
View 4 Replies
Sep 6, 2010
I would like to make the datagrid bound column to hyperlink for redirecting to the details page .
For example , when my mouse over certain row of bound column in datagrid , it will change the colour to blue . Also , I can click it and redirect to the detail page .
Notes : I don't wan to use hyperlink column
View 7 Replies