472,102 Members | 1,591 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,102 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 3105
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by Jack Kaufmann | last post: by
1 post views Thread by GregM | last post: by
2 posts views Thread by Matthias Marx | last post: by
6 posts views Thread by rodchar | last post: by
4 posts views Thread by Luis Esteban Valencia | last post: by
4 posts views Thread by siaj | last post: by
5 posts views Thread by Tina | last post: by

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.