We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

grid page control values

I would like to manually extract what value was entered in the GotoPage text for the button bar control. I would also like to be able to set the page number total for the SelectPage button bar control if possible. We return some data from the db using our own filtering and page size code and I would like to use the syncfusion buttonbar control in the .cs for the web page. I am capturing the previous and next page events but don't know if I can get/set the value through code that is entered in the GogoPage item.

Thanks in advance,
Sandy

3 Replies

AD Administrator Syncfusion Team October 19, 2006 05:57 AM UTC

Hi Sandy,

I assume you want to display Some number in the textbox in the ButtonBar, which is not the one by default, this is not possible directly and here is the workaround for doing this.

Copy the below script after closing the form tag in your aspx page. See the comments on the script for more details. please feel free to let us know if you face any issues.



script type="text/javascript">

//Here the Id is of the form grid''''s name + "GoToPageEdit" + "Button''''s Id"
// you will have to figure out your controls buttonID in your sample.
//one easy way is to see your html source and search for the ''''GoToPageEdit'''' string,

var pagerIndexVal=document.getElementById(''''GridGroupingControl1'''' + "GoToPageEdit" + "0~3");

//Say We need to display 1 on the text Box instead of '2' which will be by default. use the following code to do

pagerIndexVal.value=pagerIndexVal.value-1;

// The OnBBGoToPageCl will be the function actually triggered when the ''''GoToPageEdit'''' button is clicked,
// so we write it locally and this will be getting triggered.

I assume you are trying to go to some page which is not a default option provided in textbox.

function OnBBGoToPageCl(evt, gridName, buttonId)
{

var gridObj = __EssentialGridCollection.Get(gridName);
//We are getting the page Index and then increasing the pageIndex internally because of we will have to move to
//page number 2, when the page number is ''''1''''
var pageIndex = document.getElementById(gridName + "GoToPageEdit" + buttonId).value;
pageIndex=Number(pageIndex)+1;// here instead of '1' you can use your own paging numbers.
gridObj.DoPostBack("GOTOPAGE:BB:" + pageIndex + ":" + buttonId);
}

/script>

Please feel free to let us know if you face any trouble when doing this.

Thanks,
A.Sivakumar



AD Administrator Syncfusion Team October 19, 2006 11:57 AM UTC

Unfortunately I was doing this in the .cs page and could use the c# version of this please.


SI Sivakumar Syncfusion Team October 19, 2006 08:36 PM UTC

Hi Sandy,

I couldn't find any easy way to do this in server side, but one of the way to acheive this is, by getting the CurrentPage in the c# code and saving it in some hidden control's value, then in client side after the page is loaded, you can set the above value to the TextBox in the button bar as mentioned in the script.

Code for acheiving this :

In .cs file

HiddenControl.value=this.GridgroupingControl1.CurrentPage;

Now in client side , you can get the value of the above HiddenControl and then set it to the textbox as mentioned in the previous post.

Hope we are on the right direction and this is what you are looking for.

Let us know if you need more info.

Thanks,
A.Sivakumar

Loader.
Live Chat Icon For mobile
Up arrow icon