ListView DataPager UpdatePanel Page Method

 Creating Master Detail, one To Many ListView with Ajax.

Edit

 

 

Add

 

Insert Branches

 

 Paging Style

 

On List View or simillar type of control , you can state commandname on your linkbutton or button .

What have been recognized is insert,update,delete,cancel and custom. This will trigger event iteminserted(&ing), itemupdated(&ing),..delete,..cancel,item command.

If you want to submit changes

onbuttonclick

//this will purge all the data from grid to //datasource

foreach (ListViewDataItem item in ListView1.Items)

{

ListView1.UpdateItem(item.DataItemIndex, true);

For the Skin and modal pop up goto  http://mattberseth.com

To enable page method first you must enable it on the script manager/toolscriptmanager

Second add the Scriptmethod attribute

[WebMethod]
[System.Web.Script.Services.ScriptMethod()]

And then on the client script use the method it’s under PageMethod object.

So PageMethods.MyMethodName(param a, param b);

You can Take the Value of Eval and Compare it, but first unbox the type first, because Eval is Box to Object

Ex:Visible='<%# ((string)Eval("Type")=="Admin")

Remember that Eval is one way binding(read), Bind is two way binding.

I prefer using link button on the template, it saves space and neat not like button so ugly and take space

Source

CodeMappingsInput.zip

 

 22/10/2008

i've found a bug on .cs the ajax always return alert exception from PageRequestManagerServerErrorException

which means that error is comming during async partial postback and the error is in our server coding

 protected void ListView1_ItemUpdated(object sender, ListViewUpdatedEventArgs e)
    {
        //TODO: Add logging here, using utils.Log("Updated " + "What"
        //What can be replaced by e.values , do research here
        StringBuilder sb= new StringBuilder();
        foreach (DictionaryEntry item in e.OldValues)
        {
         if(item.Value!=null)
     
    sb.Append(item.Value.ToString());
        }
        sb.Append (" To ");
        foreach (DictionaryEntry item in e.NewValues)
        {
        if(item.Value!=null)
     
    sb.Append(item.Value.ToString());
        }
        Utils.Log("updated " + sb.ToString());

    }

 

 

Share this post: | | | |
Published Wednesday, August 06, 2008 9:14 AM by cipto
Filed under:

Comments

# re: ListView DataPager UpdatePanel Page Method

Wednesday, August 06, 2008 11:06 AM by Ari

Tetap ngga ngerti, maksudnya mau bikin apaan?

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above: