By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,665 Members | 1,430 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,665 IT Pros & Developers. It's quick & easy.

Datagrid add/insert row validation issue

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.