Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
Patrick.O.Ige #1
RequiredfiledValidator and regularexpressionvalidator in DataGrid footer
I have a Datagrid with Update,Delete and Edit buttons.
And on the footer i'm adding a new ROW to the DataGrid
I placed RequiredfiledValidator and regularexpressionvalidator in the Footer
of a DataGrid
so that i can validate the TextBoxes but when i click the Submit button in
the Footer it doesn't fire but then i click the
the Delete button on any ROW of the Datagrid it fires the
RequiredfiledValidator in the footer..
Any ideas ?
Patrick.O.Ige Guest
-
Datagrid Footer!
Hi all, I am using a datagrid footer as a container for some data entry controls. Above the datagrid is another data entry point which needs to... -
ValidationSummary not displaying error message from datagrid regularExpressionValidator
I have a datagrid with Edit, Update, Cancel. Everything without validation works fine but when the user edits the date column I would like the... -
datagrid footer question
im keeping running totals of certain columns in a datagrid, id like to put these totals in the footer - how do i do this ? or how can i put a label... -
Datagrid Footer Image
Hi - is it possible to add an image to the Footer in a datagrid? I have tried but just get a message saying it does not have a property asp:image... -
datagrid footer
I'd like to know how to add a text box in the datagrid footer at runtime. Thanks. -
Elton Wang #2
Re: RequiredfiledValidator and regularexpressionvalidator in DataGrid footer
Check the button's CausesValidation property. If it's set to false, it
doesn't fire validation.
HTH
"Patrick.O.Ige" <naijacoder@hotmail.com> wrote in message
news:ODL1Nwj6FHA.2020@TK2MSFTNGP10.phx.gbl...>I have a Datagrid with Update,Delete and Edit buttons.
> And on the footer i'm adding a new ROW to the DataGrid
> I placed RequiredfiledValidator and regularexpressionvalidator in the
> Footer
> of a DataGrid
> so that i can validate the TextBoxes but when i click the Submit button in
> the Footer it doesn't fire but then i click the
> the Delete button on any ROW of the Datagrid it fires the
> RequiredfiledValidator in the footer..
> Any ideas ?
>
>
Elton Wang Guest
-
Patrick.O.Ige #3
Re: RequiredfiledValidator and regularexpressionvalidator in DataGrid footer
Thanks Elton for the reply..but my detailed question is below:-
I have a Datagrid with Update/Edit/Cancel in the EditCommandColumn
And an insert Button in the footer to add new record..
I have set RequiredFieldValidator in the FOOTER to validate text
fields before inserting data..
Now i added another ones in the EditTemplate to check values before
updating...
When i Click on the Update button in the EditCommandColumn
it triggers the requiredfiledvalidator for the insert button and text
fileds.
How can i access the update button in the EditCommandColumn in the
edit mode?
Or how can i set the insert button in the footer to
CausesValidation=False when the update button is in the edit mode..??
"Elton Wang" <elton_wang@hotmail.com> wrote in message
news:ez8Rk7t6FHA.3340@TK2MSFTNGP10.phx.gbl...in> Check the button's CausesValidation property. If it's set to false, it
> doesn't fire validation.
>
> HTH
>
>
> "Patrick.O.Ige" <naijacoder@hotmail.com> wrote in message
> news:ODL1Nwj6FHA.2020@TK2MSFTNGP10.phx.gbl...> >I have a Datagrid with Update,Delete and Edit buttons.
> > And on the footer i'm adding a new ROW to the DataGrid
> > I placed RequiredfiledValidator and regularexpressionvalidator in the
> > Footer
> > of a DataGrid
> > so that i can validate the TextBoxes but when i click the Submit button>> > the Footer it doesn't fire but then i click the
> > the Delete button on any ROW of the Datagrid it fires the
> > RequiredfiledValidator in the footer..
> > Any ideas ?
> >
> >
>
Patrick.O.Ige Guest
-
Elton Wang #4
Re: RequiredfiledValidator and regularexpressionvalidator in DataGrid footer
Hi Patrick,
It's a little trick. Before a row becomes Edit state, the update button is
no available. So one way to do it is that in DataGrid_EditCommand event:
DataGrid.EditItemIndex = e.Item.ItemIndex;
DataGrid.DataSource = dataObj;
DataGrid.DataBind();
// up to now the e.Item.ItemIndex row of DataGrid becomes edit state. But
e.Item is still in normal state. So you need get Update button from datagrid
LinkButton updateBtn =
(LinkButton)this.DataGrid.Items[e.Item.ItemIndex].Cells[button_col_index].Controls[0];
// then set its CausesValidation
updateBtn.CausesValidation = true/false;
If you have ID for the insert button in footer, you meight use
DataGrid.FindControl("insert_button_ID") to refer the button.
HTH
"Patrick.O.Ige" <naijacoder@hotmail.com> wrote in message
news:e16ZQxv6FHA.1944@TK2MSFTNGP14.phx.gbl...> Thanks Elton for the reply..but my detailed question is below:-
>
> I have a Datagrid with Update/Edit/Cancel in the EditCommandColumn
> And an insert Button in the footer to add new record..
> I have set RequiredFieldValidator in the FOOTER to validate text
> fields before inserting data..
> Now i added another ones in the EditTemplate to check values before
> updating...
> When i Click on the Update button in the EditCommandColumn
> it triggers the requiredfiledvalidator for the insert button and text
> fileds.
> How can i access the update button in the EditCommandColumn in the
> edit mode?
> Or how can i set the insert button in the footer to
> CausesValidation=False when the update button is in the edit mode..??
>
>
>
> "Elton Wang" <elton_wang@hotmail.com> wrote in message
> news:ez8Rk7t6FHA.3340@TK2MSFTNGP10.phx.gbl...> in>> Check the button's CausesValidation property. If it's set to false, it
>> doesn't fire validation.
>>
>> HTH
>>
>>
>> "Patrick.O.Ige" <naijacoder@hotmail.com> wrote in message
>> news:ODL1Nwj6FHA.2020@TK2MSFTNGP10.phx.gbl...>> >I have a Datagrid with Update,Delete and Edit buttons.
>> > And on the footer i'm adding a new ROW to the DataGrid
>> > I placed RequiredfiledValidator and regularexpressionvalidator in the
>> > Footer
>> > of a DataGrid
>> > so that i can validate the TextBoxes but when i click the Submit button>>>>> > the Footer it doesn't fire but then i click the
>> > the Delete button on any ROW of the Datagrid it fires the
>> > RequiredfiledValidator in the footer..
>> > Any ideas ?
>> >
>> >
>>
>
Elton Wang Guest
-
Patrick.O.Ige #5
Re: RequiredfiledValidator and regularexpressionvalidator in DataGrid footer
Thx Elto i figured it out.
I actually noticed that problem when i had to make use of Validators in both
the insert and Edit /update mode.
What actually i did earlier was to set the SHOWFOOTER visible=false when in
edit mode and that worked.
But if i set my update button to CausesValidation=false as you requested my
validators won't fire.
Unless i set the insert button in the FOOTER to CausesValidation=false when
in Edit mode.
Patrick
"Elton Wang" <elton_wang@hotmail.com> wrote in message
news:er#pn686FHA.3804@TK2MSFTNGP14.phx.gbl...datagrid> Hi Patrick,
>
> It's a little trick. Before a row becomes Edit state, the update button is
> no available. So one way to do it is that in DataGrid_EditCommand event:
>
> DataGrid.EditItemIndex = e.Item.ItemIndex;
> DataGrid.DataSource = dataObj;
> DataGrid.DataBind();
> // up to now the e.Item.ItemIndex row of DataGrid becomes edit state. But
> e.Item is still in normal state. So you need get Update button from(LinkButton)this.DataGrid.Items[e.Item.ItemIndex].Cells[button_col_index].Co> LinkButton updateBtn =
>
ntrols[0];text> // then set its CausesValidation
> updateBtn.CausesValidation = true/false;
>
> If you have ID for the insert button in footer, you meight use
>
> DataGrid.FindControl("insert_button_ID") to refer the button.
>
> HTH
>
>
> "Patrick.O.Ige" <naijacoder@hotmail.com> wrote in message
> news:e16ZQxv6FHA.1944@TK2MSFTNGP14.phx.gbl...> > Thanks Elton for the reply..but my detailed question is below:-
> >
> > I have a Datagrid with Update/Edit/Cancel in the EditCommandColumn
> > And an insert Button in the footer to add new record..
> > I have set RequiredFieldValidator in the FOOTER to validate text
> > fields before inserting data..
> > Now i added another ones in the EditTemplate to check values before
> > updating...
> > When i Click on the Update button in the EditCommandColumn
> > it triggers the requiredfiledvalidator for the insert button andbutton> > fileds.
> > How can i access the update button in the EditCommandColumn in the
> > edit mode?
> > Or how can i set the insert button in the footer to
> > CausesValidation=False when the update button is in the edit mode..??
> >
> >
> >
> > "Elton Wang" <elton_wang@hotmail.com> wrote in message
> > news:ez8Rk7t6FHA.3340@TK2MSFTNGP10.phx.gbl...> >> Check the button's CausesValidation property. If it's set to false, it
> >> doesn't fire validation.
> >>
> >> HTH
> >>
> >>
> >> "Patrick.O.Ige" <naijacoder@hotmail.com> wrote in message
> >> news:ODL1Nwj6FHA.2020@TK2MSFTNGP10.phx.gbl...
> >> >I have a Datagrid with Update,Delete and Edit buttons.
> >> > And on the footer i'm adding a new ROW to the DataGrid
> >> > I placed RequiredfiledValidator and regularexpressionvalidator in the
> >> > Footer
> >> > of a DataGrid
> >> > so that i can validate the TextBoxes but when i click the Submit>> > in> >> >> > the Footer it doesn't fire but then i click the
> >> > the Delete button on any ROW of the Datagrid it fires the
> >> > RequiredfiledValidator in the footer..
> >> > Any ideas ?
> >> >
> >> >
> >>
> >>
> >
>
Patrick.O.Ige Guest



Reply With Quote

