473,805 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Gridview only show row button if something was selected and somethinghas been entered??

I've coded a gridview that has used bound data to determine if I
should show a button on a particular gridview row as follows:

<asp:TemplateFi eld>
<ItemTemplate >
<asp:Button ID="Submit" Text="Test" CommandArgument ='<
%#Eval("CNumber ") %>' CommandName="Su bmit" Enabled='<%#
Test(Eval("Proc essId")) %>' runat="server" />
</ItemTemplate>
</asp:TemplateFie ld>

Question is, how can I do the samething, but based on the value of
other columns that are yet to posted?

For example say I have a textbox column and dropdown column in the
grid. I only want the button to be visible if something has been
entered into the textbox and something has been selected on that row.

Thanks for any help or information!
Feb 13 '08 #1
2 2019
Update on this.

I figured I might be able to accomplish this with in the rowcreated
event of the gridview. However, oddly enough, when I test my
dropdown's selected value, it's always showing the default selected
value, regardless of current viewstate value.

Any ideas?

Protected Sub AddPoints_RowCr eated(ByVal sender As Object, ByVal e
As System.Web.UI.W ebControls.Grid ViewRowEventArg s) Handles
gridAddPoints.R owCreated
If e.Row.RowType = DataControlRowT ype.DataRow Then
Dim minutes As String =
CType(e.Row.Cel ls(4).FindContr ol("Minutes"),
DropDownList).S electedValue
If Not minutes = "Enter Minutes" Then
' NEVER TRUE THOUGH I DO SELECT ANOTHER VALUE.
Dim SubmitPoint As Button =
CType(e.Row.Cel ls(5).Controls( 0), Button)
SubmitPoint.Ena bled = "True"
End If
End If
End Sub

Feb 13 '08 #2
It must be the week for the GridView... You like someone else earlier have
what appears to be a mix of thing you want to do with the grid. I would
suggest that if you have something that is not working you post the code and
that will make life a lot easier for to help you.
--
aaa
"wi*****@noclie nt.net" wrote:
I've coded a gridview that has used bound data to determine if I
should show a button on a particular gridview row as follows:

<asp:TemplateFi eld>
<ItemTemplate >
<asp:Button ID="Submit" Text="Test" CommandArgument ='<
%#Eval("CNumber ") %>' CommandName="Su bmit" Enabled='<%#
Test(Eval("Proc essId")) %>' runat="server" />
</ItemTemplate>
</asp:TemplateFie ld>

Question is, how can I do the samething, but based on the value of
other columns that are yet to posted?

For example say I have a textbox column and dropdown column in the
grid. I only want the button to be visible if something has been
entered into the textbox and something has been selected on that row.

Thanks for any help or information!
Feb 13 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2108
by: Carlos Albert | last post by:
Hi everyone, Is there a way to make a column that has an image with a hyperlink on it? Cause I know how to make a hyperlink column, and a image column, but not how to mix it both... Tnx!
1
3871
by: John_H | last post by:
Re: ASP.NET 2.0 I would like suggestions or code examples on how to collect a variable length list of input data (item# & item quantity specifically). I thought that I could accomplish this using a GridView that has ViewState enabled, an ObjectDataSource to process the submitted list, textboxes for getting new item data and an add button. Does this approach sound feasible or are there better alternatives? My problem is that I don't...
1
6136
by: sheenaa | last post by:
Hello Members, I m creating my application forms in ASP.Net 2005 C# using the backend SQL Server 2005. What i have used on forms :: ? On my first form i have used some label,textboxs,dropdownlists,radiobutton and checkbox asp standard controls. On the click event of the command button the data gets stored into the database. I have created the stored procedures for the insert,update,delete. I have...
12
27190
by: dixonjm | last post by:
Hi, I am new to gridviews, so any help would be most appreciated. Here is my problem:- I have a form with a GridView and a button. My gridview is bound to a collection (12000 items) (PageSize = 200) and it has 4 columns: 1st Col =
2
11638
by: Steve | last post by:
I have a gridview and I want to delete a row that is highlighted, but I want to show a confirmation box also 'you sure?', but I only want this to show if a row in the gridview is highlighted. What is the best way to do this other then disabling the delete button until a row is highlighted?
2
9143
by: wildman | last post by:
RE: Gridview textbox has data check without postback.. javascript? I have a gridview with a textbox. I can set the textbox to autopostback and check for a value in a prerender event to decide if I should make a button on the grid row visible. However, the problem with autopostback on a textbox is the postback occurrs when you select another control or click away ( I guess). This is very awkward when the control selected is dropdown as...
2
2834
by: GISmatters | last post by:
I have unbound checkboxes in a nested gridview to allow multi-selection of "child" rows. For context, the parent gridview rows are for large "reports", the child rows are for various specific files comprising each report. I want the user to be able to select an arbitrary collection of report files and have them emailed by clicking an "Email selected files" button. Everything displays properly, including the checkboxes for each child row (each...
6
1988
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have a gridview control with a template column that has a textbox and when the control is bound to the datasource the textbox is filled ok. I then change what is in the textbox in the gridview control and in the gridview_RowDataBound event I have string DiscDescrip = Convert.ToString((e.Row.Cells.FindControl("txbxDiscgv") as TextBox ).Text); This returns what was initially loaded in the textbox but not what I had just changed it...
3
11467
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have a gridview with one of the columns as a template column with a button. When the user selects the button is there a way to get the row number in the button_Click event? Another one of the columns is a template column that has a label that I have displaying the row number. Thanks -- Paul G Software engineer.
0
9718
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10614
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10109
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7649
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3847
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.