2014年7月13日 星期日

[RESOLVED] PagerTemplate


Hi, I need your appreciated help.


I need disbaled in my aspx page all RequiredFieldValidator when are selected the button first, prev, next and last in pager template.

Any help would be appreciated.



CommandArgument="First" CommandName="Page" />
CommandArgument="Prev" CommandName="Page" />
Page
OnSelectedIndexChanged="ddlPages_SelectedIndexChanged">

of

CommandArgument="Next" CommandName="Page" />
CommandArgument="Last" CommandName="Page" />




protected void Paginate(object sender, CommandEventArgs e)
{
int intCurIndex = gV.PageIndex;

switch (e.CommandArgument.ToString().ToLower())
{
case "First":
gV.PageIndex = 0;
break;
case "Prev":
gV.PageIndex = intCurIndex - 1;
break;
case "Next":
gV.PageIndex = intCurIndex + 1;
break;
case "Last":
gV.PageIndex = gV.PageCount - 1;
break;
}

gV.DataBind();
}







 



Hi,


  You can Achieve this with the help of ValidationGroups. Basically validations will be fired for all the controls which are having same validation groups.


  So Set a different validation group for your first, prev,next and last buttons. It will fix the issues.


Thanks,





romy.thomas



Hi,


  You can Achieve this with the help of ValidationGroups. Basically validations will be fired for all the controls which are having same validation groups.


  So Set a different validation group for your first, prev,next and last buttons. It will fix the issues.


Thanks,





thank you for help, any example please?



Hi,


   Try this


  

                           
                                CommandArgument="First" CommandName="Page" ValidationGroup="Group1" />

                           
                                CommandArgument="Prev" CommandName="Page" ValidationGroup="Group1"/>

                            Page

                           
                                OnSelectedIndexChanged="ddlPages_SelectedIndexChanged">

                           


                            of

                           

                           
                                CommandArgument="Next" CommandName="Page" ValidationGroup="Group1"/>

                           
                                CommandArgument="Last" CommandName="Page" ValidationGroup="Group1"/>

                       



Thanks,



Got it!! you must set the CauseValidation attribute on the buttoncontrol to false!



Hi,


As
romy.thomas
said you can use validation groups for this purpose. Below is the sample..



*




check both the validation groups of Requiredfield validator and button are same (first). Other button is having another group.




沒有留言:

張貼留言