Forms Data Controls :: Gridview Control - Making Another Field Mandatory?
Jun 29, 2010
based on the content of a field in my gridview, I would like to make another field mandatory..So its like this, if the field in my gridview called "Name" = Fred then the "Salary" field is mandatory and has to be filled in by the user, however if the field name is not "Fred" then the salary field is not required..how can this be achieved?
View 3 Replies
Similar Messages:
Aug 31, 2010
Coding is not working for Making Password Field Encrypted in sql
View 1 Replies
Mar 31, 2010
I have a gridview and basically at page load I want it to display with an empty row. The first field in the gridview would be a template field containing a textbox. I wan't to be able to type in, for example, a product code ('abc'). This would be the parameter for the stored procedure and then the rest of the columns (40+ additional columns) in the gridview would populate with the rest of the data pertaining to that product code (i.e. price, unit of measure, etc.). In short the template field texbox is the control to bind the gridview.
After the row is populated I could click a button or link that would add that entire row to my gridview and then add another empty row where I could enter another product code... populate the row then add that row to the gridview. and so on...
View 5 Replies
Mar 9, 2011
OnSelectedIndexChanged event for the dropdown is the fired.
I have set the autopost back value = "true", EnableViewState ="true" for page tag and gridview tag.
View 15 Replies
Mar 6, 2010
when updating a decimal field in a GridView all is fine when using e.g. "2.3" ("." to separate the fraction!)
However, when using "2,3" I get e formatstring exception!
I tried "regularExpressionValidator/RequiredFieldvalidator" but did not succeed! Tried also with FormatString like {0:n}.....
Questions:
is this controllable by "Culture / UICulture" in web.config (played with it without success!
How do I best check for correct input i.e. force "." as separator
Can I use the "DataFormatString" property for the appropriate GridView field (like {0:n}) ......
[code]....
View 1 Replies
Dec 10, 2010
I need to bind a List control based on the Gridview Row's datakeyName value while the Gridview control is being loaded into the page. I tried the following but it does not work.The BulletedList control is nested inside a Gridview Control and they both bound to an ObjectDataSource control. In my code, I passed teh UserID into the UserID parameter and call the Select() method but still does not work. Basically, I want to list of a user's hobbies, therefore the hobbies control are driven by the userID. tell me how can I get it to work?
protected void UserGridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
int UserID;
[code]...
View 1 Replies
Feb 8, 2011
I hav a gridview in which i display the project name,created date,Start time ,end time ,total hours along with the task id field which is visible=false.
My starttime and endtime format is 2010-10-13 03:00:00,but i want to display these two fields in dropdownlist ie.,only i want to display the HH:MM:SS in dropdown so that when the user changes the time it should be automatically be reflected in the total hours(6:0) field after updating.pls tell me what i have to do to bring the Hours ,minutes and seconds in dropdownlist into the cells of gridview with the value in database ,how to write the code.
View 1 Replies
Jun 11, 2010
I want to hyperlink from a field in one gridview to a field in another gridview based on id. I've tried many ways but haven't seen success.
View 20 Replies
Jul 9, 2010
I have 2 fields in my gridview one called ScriptType the other BagNo, when a user click the edit button, I would like the BagNo filed to be disabled if the ScriptType field is = "TTA" and enabled otherwise. How can I do this?..something along these lines see below..I am using VB..
[code]...
View 14 Replies
Apr 9, 2010
I have a gridview that has both a select and an update statement. One of the cells is a date cell, and the other is for numerics only. Is there a way I can do this? At the moment, anything can be keyed into the cells and this results in an error as my update stored procedure expects a date value and a numeric value respectively.
View 2 Replies
Mar 11, 2010
I have got 2 Drop Down Lists on my Form and 1 GridView. I want GridView to display the data according to selection from the Drop Down Lists.
For Example, One Drop Down List contains Names and other contains Dates. Both the Drop Down Lists can post back. So if i select a name from 1st Drop Down list, the Grid View should show all the results according to that Name. Similarly if i select the Date from the other Drop Down List , the Grid View should show the results according to the dates. But i cant figure out as how to bind Grid View to respond to 2 Drop Down List.
BTW i am binding both the Drop Down Lists and the Grid View to the DataSource Objects, which is getting data from the database.
View 12 Replies
Dec 18, 2010
I have a gridview in page with following code:
Grid present data as following example:
12/17/2010 apple send
12/18/2022 grape send
my template code is:
Collapse
View 6 Replies
Dec 19, 2010
I have a grid view, and I add new column as a hyper link field, I want the navigationURL for this field to be Pageexample.aspx?ID=other field value like this
[code]...
is that possible ?
View 2 Replies
Dec 23, 2010
how to make gridview with scrollbar with making header static.
View 2 Replies
Apr 8, 2010
I have one GridView called GV_IssTypeDesc and one DetailsView called DV_IssueLog.
The scenario is that i only want GV_IssTypeDesc gridview to appear when DetailsView DV_IssueLog is in edit mode. How do i accomplish this?
I refered to: [URL]
For now i have done the following:
UpdateIssue.aspx
<asp:DetailsView ID="DV_IssueLog" runat="server" Height="50px" Width="400px"
AutoGenerateRows="False" DataKeyNames="dbIssID" OnModeChanging="DV_IssueLog_ModeChanging"
DataSourceID="SqlDS_IssueLog" BackColor="White" BorderColor="#E7E7FF"
BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Horizontal">
<asp:GridView ID="GV_IssTypeDesc" runat="server" AutoGenerateColumns="False"
CellPadding="4" DataSourceID="SqlDS_IssTypeDesc" ForeColor="#333333"
GridLines="None" Visible="false">
UpdateIssue.aspx.vb
Protected Sub DV_IssueLog_ModeChanging(ByVal sender As Object, ByVal e As System.EventArgs)
If e.NewMode = DetailsViewMode.Edit Then
GV_IssTypeDesc.Visible = True
Else
GV_IssTypeDesc.Visible = False
End If
End Sub
The "e.NewMode" is underlined blue in color and it is stated "NewMode is not a member of System.EvntArgs".
How do i solve this problem?
By the way, I am using Web Developer 2008, VB.net.
View 7 Replies
Nov 2, 2010
Im making a gridview that need to show the information of a user that is logged in, but i got the "?" ERROR whole the time.
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
View 1 Replies
Sep 20, 2010
I have a gridview setup and have the select button enabled. I also have a gridview that doesnt have a select button enabled..
On them both, if its possible, i would like to make the row itself selectable instead of just enabling the select button.
View 2 Replies
Mar 26, 2016
Query 1 - Grid View: - I have an excel sheet which I import into gridview at runtime. For excel sheet import, I have a fileupload dialog box and an asp.net button control which when clicked imports the sheet contents into a gridview. The problem is I have my fileupload box and button control in a page called Default.aspx and I need the gridview get displayed maximized in a new page called Default2.aspx.
Also, I need to specify the row number of the field titles from the excel sheet dynamically at runtime so that the gridview appends any new field/column from that row on. The excel sheets I use contain complex formatting. Is there anyway to display the excelsheet contents as they have been defined and formatted?
Query 2 - Sessions: - I add nodes to my treeview dynamically at runtime. Since HTTP is a stateless protocol, the changes which I do remain only for that session. How do I append the changes I do to the treeview simultaneously in the code?
- I have appended 2 extra columns into the excel sheet generated gridview which take input through dropdownlistbox control at runtime. How do I update and retain those changes in the gridview?
View 1 Replies
Aug 21, 2010
I have grid view control that includes a dropdown control in a template field.I wish to execute some code when the value is changed in the dropdown list. Can't figure out how to capture this event though?
View 5 Replies
Feb 24, 2011
If certain attributes on built-in ASP.NET controls aren't specified, then an exception will be thrown.
How do I do this on my custom user/server control?
View 2 Replies
Apr 12, 2010
I have on a page a gridview that can be filtered with one text box. I set up the gridview to show select and wanted to then connect a details view so that when you selected a row the entire details would show up. When I run it I get this error. Data keys must be specified on GridView 'GridView1' before the selected data keys can be retrieved. Use the DataKeyNames property to specify data keys.
<%@ Page language="C#" masterpagefile="MainContent.master" title="Electrical Storage" EnableEventValidation="false" %>
<asp:Content id="Content1" runat="server" contentplaceholderid="Content">
<div id="Rightside">
<h2>Search Electrical Storage
</h2>
<li><a href="EStorageResultsAll.aspx">View All Files</a></li>
<li>Specify Projects to View</li>
<br />
<br />
<form>
Search: <asp:TextBox id="Search" runat="server"></asp:TextBox>
(% is wildcard)<br /><br />
<asp:Button runat="server" Text="Search" id="Button1"
PostBackUrl="electrical_storage.aspx" Height="26px" BackColor="#000066" ForeColor="White" Width="129px"></asp:Button>
<br />
<hr />
<asp:GridView id="GridView1" runat="server" AutoGenerateColumns="False" BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2" DataSourceID="AccessDataSource1" ForeColor="Black" Width="820px" AllowSorting="True">
<RowStyle BackColor="White" />
<Columns>
<asp:commandfield ShowSelectButton="True">
</asp:commandfield>
<asp:boundfield DataField="CoID" HeaderText="Co ID" SortExpression="CoID">
</asp:boundfield>
<asp:boundfield DataField="ProjClass" HeaderText="Project Class" SortExpression="ProjClass">
</asp:boundfield>
<asp:boundfield DataField="Project" HeaderText="Project" SortExpression="Project">
</asp:boundfield>
<asp:boundfield DataField="FileName" HeaderText="File Name" SortExpression="FileName">
</asp:boundfield>
<asp:boundfield DataField="FileAddInfo" HeaderText="File Add Info" SortExpression="FileAddInfo" Visible="False">
</asp:boundfield>
<asp:boundfield DataField="FileNumber" HeaderText="File Number" SortExpression="FileNumber" Visible="False">
</asp:boundfield>
<asp:boundfield DataField="BoxNumber" HeaderText="Box Number" SortExpression="BoxNumber" Visible="False">
</asp:boundfield>
<asp:boundfield DataField="Location" HeaderText="Location" SortExpression="Location" Visible="False">
</asp:boundfield>
</Columns>
<FooterStyle BackColor="#CCCCCC" />
<PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#000066" Font-Bold="True" ForeColor="White" />
</asp:GridView>
<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="\Elec1DATABASEStorageElectricalFilesBook.mdb" SelectCommand="SELECT [CoID], [ProjClass], [Project], [FileName], [FileAddInfo], [FileNumber], [BoxNumber], [Location] FROM [FilesWithLocation]
WHERE (([CoID] LIKE '%' + ? + '%') OR ([ProjClass] LIKE '%' + ? + '%') OR ([Project] LIKE '%' + ? + '%')OR ([FileName] LIKE '%' + ? + '%')OR ([FileAddInfo] LIKE '%' + ? + '%')OR ([BoxNumber] LIKE '%' + ? + '%'))">
<SelectParameters>
<asp:controlparameter ControlID="Search" Name="CoID" PropertyName="Text" Type="String" />
<asp:controlparameter ControlID="Search" Name="ProjClass" PropertyName="Text" Type="String" />
<asp:controlparameter ControlID="Search" Name="Project" PropertyName="Text" Type="String" />
<asp:controlparameter ControlID="Search" Name="FileName" PropertyName="Text" Type="String" />
<asp:controlparameter ControlID="Search" Name="FileAddInfo" PropertyName="Text" Type="String" />
<asp:controlparameter ControlID="Search" Name="FileNumber" PropertyName="Text" Type="String" />
<asp:controlparameter ControlID="Search" Name="BoxNumber" PropertyName="Text" Type="String" />
</SelectParameters>
</asp:AccessDataSource>
<asp:AccessDataSource id="AccessDataSource2" runat="server" DataFile="\Elec1DATABASEStorageElectricalFilesBook.mdb" SelectCommand="SELECT * FROM [FilesWithLocation] WHERE ([SearchString] = ?)">
<SelectParameters>
<asp:controlparameter ControlID="GridView1" Name="SearchString" PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:AccessDataSource>
<asp:DetailsView id="DetailsView1" runat="server" AutoGenerateRows="False" DataSourceID="AccessDataSource2" Height="50px" Width="442px">
<Fields>
<asp:boundfield DataField="CoID" HeaderText="Company ID" SortExpression="CoID">
</asp:boundfield>
<asp:boundfield DataField="ProjClass" HeaderText="Project Class" SortExpression="ProjClass">
</asp:boundfield>
<asp:boundfield DataField="Project" HeaderText="Project" SortExpression="Project">
</asp:boundfield>
<asp:boundfield DataField="FileName" HeaderText="File Name" SortExpression="FileName">
</asp:boundfield>
<asp:boundfield DataField="FileAddInfo" HeaderText="File Additional Info" SortExpression="FileAddInfo">
</asp:boundfield>
<asp:boundfield DataField="PeriodBegin" DataFormatString="{0:d}" HeaderText="Period Begin" SortExpression="PeriodBegin">
</asp:boundfield>
<asp:boundfield DataField="PeriodEnd" DataFormatString="{0:d}" HeaderText="Period End" SortExpression="PeriodEnd">
</asp:boundfield>
<asp:boundfield DataField="FileType" HeaderText="File Type" SortExpression="FileType">
</asp:boundfield>
<asp:boundfield DataField="FileNumber" HeaderText="File Number" SortExpression="FileNumber">
</asp:boundfield>
<asp:boundfield DataField="BoxNumber" HeaderText="Box Number" SortExpression="BoxNumber">
</asp:boundfield>
<asp:boundfield DataField="SearchString" HeaderText="Search String" ReadOnly="True" SortExpression="SearchString">
</asp:boundfield>
<asp:boundfield DataField="Location" HeaderText="Location" SortExpression="Location">
</asp:boundfield>
</Fields>
</asp:DetailsView>
</form>
</div>
</asp:Content>
<asp:Content id="Content2" runat="server" contentplaceholderid="head">
<style type="text/css">
table {
width: 820px;
}
.gridview {
width: 820px;
position: fixed;
}
</style>
</asp:Content>
View 5 Replies
Jan 21, 2010
I have a gridView where i have to show the follow the following details
InvoiceNo InvDate PendingSince InvAmt
Inv1 01/01/2010 (Current Date - InvDate) 12000
Inv2 15/01/2010 (Current Date - InvDate) 20000
Can anyone tell me how do we get the highlighted field in a GridView. The other 3 fields are bounded fields. also tell me whether the highlighted field is a bounded or template filed.
View 6 Replies
Jan 7, 2010
I have a Gridview with ID "GVSeasonsOfResort" which has selectable rows.
One of the fields in that gridview is RSLinkID which is an ID field of the table from which ths SQLDataSource driving the gridview gets its data.
I have a textbox outside the gridview with ID TxtBxRSLinkID and when I select a row of the Gridview, I want to assign the value of the RSLinkID field of the selected row to the TxtBxRSLinkID.
[code]....
View 2 Replies
Nov 29, 2010
How can I get a value from a cell in the gridview for further calculation.I have a gridview with the following fieldsRecord ID, user ID, and worked hours.now I want to use the UserID shown in the gridview to query the cost per hour for the specified user in the gridview.I want to use this value in the code behind file, any tips on how to accomplish this? I use Linq2SQL.
View 4 Replies
Jul 31, 2013
i am implementing a update query module.i am displaying all fields from a table for a term searched. well now i am implementing update option for the record which are displayed, i have like 70 columns in my table, and i want to know how to restrict some selected fields to be only read only while the form can be updated ?Like if user select to update a record then some selected field such as "Timestamp, UID etc some selected fields" remains READ ONLY !
View 1 Replies