473,416 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Datagrid add/insert row validation issue

Based upon some prevoius postings on what to do for adding a 'add' row to a
datagrid I utilize the footer to create the 'add' row. The only issue is that
I have it sharing the 'UpDate_Command' and I use an argument to difference
between an 'edit' vs. and 'add. But since I have field validation on both
'footer' and 'edit' columns I can't submit my edits since the footer
validation kicks in.If I take the validation off then the both work fine (an
insert or an update to record)

Add link:
<FooterTemplate>
<asp:LinkButton id="btnAddRow" runat="server" CssClass="gridqtext"
Text="<u>Add</u>" CommandName="Update" CommandArgument="Insert">
</asp:LinkButton>
</FooterTemplate>

edit links:
<asp:EditCommandColumn ItemStyle-Width="75" ItemStyle-CssClass="gridtext"
ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel"
EditText="Edit">
</asp:EditCommandColumn>

they are both sharing the:
Private Sub gdconcerndetail_UpdateCommand(ByVal source As System.Object,
ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
gdconcerndetail.UpdateCommand

Ideas? Thanx.
Nov 19 '05 #1
5 3212
just noticed post in Jan, but solution was there isn't one I guess?
Does anyone know some good customvalidator examples that maybe can be used
here?

thanx.

"Chris" wrote:
Based upon some prevoius postings on what to do for adding a 'add' row to a
datagrid I utilize the footer to create the 'add' row. The only issue is that
I have it sharing the 'UpDate_Command' and I use an argument to difference
between an 'edit' vs. and 'add. But since I have field validation on both
'footer' and 'edit' columns I can't submit my edits since the footer
validation kicks in.If I take the validation off then the both work fine (an
insert or an update to record)

Add link:
<FooterTemplate>
<asp:LinkButton id="btnAddRow" runat="server" CssClass="gridqtext"
Text="<u>Add</u>" CommandName="Update" CommandArgument="Insert">
</asp:LinkButton>
</FooterTemplate>

edit links:
<asp:EditCommandColumn ItemStyle-Width="75" ItemStyle-CssClass="gridtext"
ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel"
EditText="Edit">
</asp:EditCommandColumn>

they are both sharing the:
Private Sub gdconcerndetail_UpdateCommand(ByVal source As System.Object,
ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
gdconcerndetail.UpdateCommand

Ideas? Thanx.

Nov 19 '05 #2
Hi Chris,

If the problem is about validation, you might disable
client-side validation and use server-side validation.

If the problem is two buttons share UpDate_Command event,
you can change CommandName of button in footer, i.e. to
Add, then handle datagrid_ItemCommand Event:

If e.CommandName = "Add" Then
' process
End

Actually, ItemCommand Occurs when any button is clicked in
the DataGrid control.

HTH,

Elton Wang
el********@hotmail.com
-----Original Message-----
Based upon some prevoius postings on what to do for adding a 'add' row to adatagrid I utilize the footer to create the 'add' row. The only issue is thatI have it sharing the 'UpDate_Command' and I use an argument to differencebetween an 'edit' vs. and 'add. But since I have field validation on both'footer' and 'edit' columns I can't submit my edits since the footervalidation kicks in.If I take the validation off then the both work fine (aninsert or an update to record)

Add link:
<FooterTemplate>
<asp:LinkButton id="btnAddRow" runat="server" CssClass="gridqtext"Text="<u>Add</u>" CommandName="Update" CommandArgument="Insert"></asp:LinkButton>
</FooterTemplate>

edit links:
<asp:EditCommandColumn ItemStyle-Width="75" ItemStyle- CssClass="gridtext"ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel"EditText="Edit">
</asp:EditCommandColumn>

they are both sharing the:
Private Sub gdconcerndetail_UpdateCommand(ByVal source As System.Object,ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs )
Handlesgdconcerndetail.UpdateCommand

Ideas? Thanx.
.

Nov 19 '05 #3
I'm trying to understand your response, maybe I'm not understanding it.
This is a validation issue, meaning the form ca not be submitted, etc.
So even though I have e.CommandArgument = "Insert" (see the tag in the first
post below) it never reaches it becuase the validation fails.
The strange thing is when I add a record, the validation is only for that
row The footer). When I enter into edit on a row then try to update that row
the validation fires first for add only('insert')?
the edit column doesn't have any arguments
edit links:
<asp:EditCommandColumn ItemStyle-Width="75" ItemStyle- CssClass="gridtext"
ButtonType="LinkButton" UpdateText="Update"

CancelText="Cancel"
EditText="Edit">
</asp:EditCommandColumn>



"Elton Wang" wrote:
Hi Chris,

If the problem is about validation, you might disable
client-side validation and use server-side validation.

If the problem is two buttons share UpDate_Command event,
you can change CommandName of button in footer, i.e. to
Add, then handle datagrid_ItemCommand Event:

If e.CommandName = "Add" Then
' process
End

Actually, ItemCommand Occurs when any button is clicked in
the DataGrid control.

HTH,

Elton Wang
el********@hotmail.com
-----Original Message-----
Based upon some prevoius postings on what to do for

adding a 'add' row to a
datagrid I utilize the footer to create the 'add' row.

The only issue is that
I have it sharing the 'UpDate_Command' and I use an

argument to difference
between an 'edit' vs. and 'add. But since I have field

validation on both
'footer' and 'edit' columns I can't submit my edits since

the footer
validation kicks in.If I take the validation off then the

both work fine (an
insert or an update to record)

Add link:
<FooterTemplate>
<asp:LinkButton id="btnAddRow" runat="server"

CssClass="gridqtext"
Text="<u>Add</u>" CommandName="Update"

CommandArgument="Insert">
</asp:LinkButton>
</FooterTemplate>

edit links:
<asp:EditCommandColumn ItemStyle-Width="75" ItemStyle-

CssClass="gridtext"
ButtonType="LinkButton" UpdateText="Update"

CancelText="Cancel"
EditText="Edit">
</asp:EditCommandColumn>

they are both sharing the:
Private Sub gdconcerndetail_UpdateCommand(ByVal source

As System.Object,
ByVal e As

System.Web.UI.WebControls.DataGridCommandEventArgs )
Handles
gdconcerndetail.UpdateCommand

Ideas? Thanx.
.

Nov 19 '05 #4
Hi Chris, I was on another thread that sounds like a match to this:
http://www.asp.net/Forums/ShowPost.a...&PostID=128371

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:E8**********************************@microsof t.com...
I'm trying to understand your response, maybe I'm not understanding it.
This is a validation issue, meaning the form ca not be submitted, etc.
So even though I have e.CommandArgument = "Insert" (see the tag in the
first
post below) it never reaches it becuase the validation fails.
The strange thing is when I add a record, the validation is only for that
row The footer). When I enter into edit on a row then try to update that
row
the validation fires first for add only('insert')?
the edit column doesn't have any arguments
edit links:
><asp:EditCommandColumn ItemStyle-Width="75" ItemStyle-

CssClass="gridtext"
>ButtonType="LinkButton" UpdateText="Update"

CancelText="Cancel"
>EditText="Edit">
></asp:EditCommandColumn>



"Elton Wang" wrote:
Hi Chris,

If the problem is about validation, you might disable
client-side validation and use server-side validation.

If the problem is two buttons share UpDate_Command event,
you can change CommandName of button in footer, i.e. to
Add, then handle datagrid_ItemCommand Event:

If e.CommandName = "Add" Then
' process
End

Actually, ItemCommand Occurs when any button is clicked in
the DataGrid control.

HTH,

Elton Wang
el********@hotmail.com
>-----Original Message-----
>Based upon some prevoius postings on what to do for

adding a 'add' row to a
>datagrid I utilize the footer to create the 'add' row.

The only issue is that
>I have it sharing the 'UpDate_Command' and I use an

argument to difference
>between an 'edit' vs. and 'add. But since I have field

validation on both
>'footer' and 'edit' columns I can't submit my edits since

the footer
>validation kicks in.If I take the validation off then the

both work fine (an
>insert or an update to record)
>
>Add link:
><FooterTemplate>
><asp:LinkButton id="btnAddRow" runat="server"

CssClass="gridqtext"
>Text="<u>Add</u>" CommandName="Update"

CommandArgument="Insert">
></asp:LinkButton>
></FooterTemplate>
>
>edit links:
><asp:EditCommandColumn ItemStyle-Width="75" ItemStyle-

CssClass="gridtext"
>ButtonType="LinkButton" UpdateText="Update"

CancelText="Cancel"
>EditText="Edit">
></asp:EditCommandColumn>
>
>they are both sharing the:
> Private Sub gdconcerndetail_UpdateCommand(ByVal source

As System.Object,
>ByVal e As

System.Web.UI.WebControls.DataGridCommandEventArgs )
Handles
>gdconcerndetail.UpdateCommand
>
>Ideas? Thanx.
>.
>

Nov 19 '05 #5
Hi

I didn't fully understand your question. Now I got it.

Client-side validation logic doesn't care, actually
doesn't know which button is clicked. To client-side it
either submit or not depending validated fields. So it's
difficult to control its workflow. In that case, you might
change it to server-side validation. On server-side, if
button in footer is clicked, you know you don't need worry
about textbox in edit field, so you only check text fields
in footer, vice versa. The disadvantage of server-side
validation is negative performance and there is no any pre-
built control. You have you're your own validation logic.
HTH

-----Original Message-----
I'm trying to understand your response, maybe I'm not understanding it.This is a validation issue, meaning the form ca not be submitted, etc.So even though I have e.CommandArgument = "Insert" (see the tag in the firstpost below) it never reaches it becuase the validation fails.The strange thing is when I add a record, the validation is only for thatrow The footer). When I enter into edit on a row then try to update that rowthe validation fires first for add only('insert')?
the edit column doesn't have any arguments
edit links:
><asp:EditCommandColumn ItemStyle-Width="75" ItemStyle-

CssClass="gridtext"
>ButtonType="LinkButton" UpdateText="Update"

CancelText="Cancel"
>EditText="Edit">
></asp:EditCommandColumn>

"Elton Wang" wrote:
Hi Chris,

If the problem is about validation, you might disable
client-side validation and use server-side validation.

If the problem is two buttons share UpDate_Command

event, you can change CommandName of button in footer, i.e. to
Add, then handle datagrid_ItemCommand Event:

If e.CommandName = "Add" Then
' process
End

Actually, ItemCommand Occurs when any button is clicked in the DataGrid control.

HTH,

Elton Wang
el********@hotmail.com
>-----Original Message-----
>Based upon some prevoius postings on what to do for

adding a 'add' row to a
>datagrid I utilize the footer to create the 'add' row.

The only issue is that
>I have it sharing the 'UpDate_Command' and I use an

argument to difference
>between an 'edit' vs. and 'add. But since I have field

validation on both
>'footer' and 'edit' columns I can't submit my edits
since the footer
>validation kicks in.If I take the validation off then
the both work fine (an
>insert or an update to record)
>
>Add link:
><FooterTemplate>
><asp:LinkButton id="btnAddRow" runat="server"

CssClass="gridqtext"
>Text="<u>Add</u>" CommandName="Update"

CommandArgument="Insert">
></asp:LinkButton>
></FooterTemplate>
>
>edit links:
><asp:EditCommandColumn ItemStyle-Width="75" ItemStyle-

CssClass="gridtext"
>ButtonType="LinkButton" UpdateText="Update"

CancelText="Cancel"
>EditText="Edit">
></asp:EditCommandColumn>
>
>they are both sharing the:
> Private Sub gdconcerndetail_UpdateCommand(ByVal
source As System.Object,
>ByVal e As

System.Web.UI.WebControls.DataGridCommandEventArgs )
Handles
>gdconcerndetail.UpdateCommand
>
>Ideas? Thanx.
>.
>

.

Nov 19 '05 #6

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

Similar topics

14
by: Jack Kaufmann | last post by:
I am trying to verify a datagrid in which there must be an entry in both columns of any new row, and those values must be greater than the corresponding values in the previous row. It is pretty...
1
by: GregM | last post by:
I have a read only datagrid that is designed to coordinate itself with textboxes. When the user clicks on a row in the datagrid, detailed data for that row is displayed for editing in the...
2
by: Matthias Marx | last post by:
Hello NG ASP:NET c# 1.1 I have to develop an existing c#, web application. There is a datagrid. With the Edit/Update function, where you could edit the value within the row. I need a...
6
by: rodchar | last post by:
Hey all, I'm trying to implement validation in my asp.net datagrid. For example, if a user enters in a Customer ID I want it to check a different data table to see if the customer exists. I'm...
4
by: Luis Esteban Valencia | last post by:
I have a asp.net page (C#), with a datagrid. I use template for all columns, and have <asp:requiredfieldvalidator> in with one of the textboxes, to make sure it's filled in. However, this...
4
by: siaj | last post by:
Hello All, If some one has faced a similar issue.. My datagrid Update command is not getting fired in fact it seems that the no event fires on clicking the update link. Although the cancel and the...
2
by: Playmaker | last post by:
Hopefully someone else has come across this issue. What I have is a SQL Server 2000 back-end. I've created a simple webform which has both Gridview and DataList controls on it populated with a...
5
by: Tina | last post by:
the Edit, Update, Cancel, and Delete buttons in my datagrid are causing validation elsewhere on the page. I want to specify that these buttons should not cause validation but they have no design...
3
by: Bob Alston | last post by:
I have a routine to copy data to new versions of my app via insert into sql statements. Unfortunately, due to evolution of my app, sometimes the new version has more restrictive editing than an...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...
0
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...

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.