When i click one button i calling one api and i geting xml formated data and i binding to dropdownlist. my problem is when i click two times its binding two times to dropdownlist. i mean its duplicating data. So my question is how can avoid duplicate
data from xml when click scond time below i giving my code
When i click one button i calling one api and i geting xml formated data and i binding to dropdownlist. my problem is when i click two times its binding two times to dropdownlist. i mean its duplicating data. So my question is how can avoid duplicate data from
xml when click scond time below i giving my code
You can just disable the button once the button is clicked.
As per my application requirment i can't disable button
Then what you can do is add another property to your Response model like
public bool ResponseDone { get; set; } which will be set to true from your method. Then in client you can store the value of this property and before a button click, check whether it is false or not. If false you make the request to
server otherwise return.
I mean my search criteria will change. then i need to again want to go api.
I am not sure I understand what you mean. But if my previous idea does not work for you (client side) then maybe you can store the flag in server side like in database or cache store and read from there whether you should response or not.
Member
82 Points
263 Posts
Avoid duplicate data from api
Jan 09, 2015 02:50 AM|binumon03|LINK
Hi All,
When i click one button i calling one api and i geting xml formated data and i binding to dropdownlist. my problem is when i click two times its binding two times to dropdownlist. i mean its duplicating data. So my question is how can avoid duplicate data from xml when click scond time below i giving my code
string url_parameter = "ExtApiUserId=Ext_0000213426&ExtApiPassword=g43XhnVqUiHF&CompanyName=0000213426&OperatingEnvironment=Production&ProductVersion=1.0&SelectColumns=DriverKey,TruckKey,ResourceKey&SearchKey_1=EarliestStartDate&SearchKey_2=LatestEndDate&SearchOperator_1=LTEQ&SearchOperator_2=GTEQ&SearchValue_1=" + delDate + "00:00:00&SearchValue_2=" + DelToarrnew[2] + "-" + DelToarrnew[0] + "-" + DelToarrnew[1] + "T23:59:59" + "&SortKey_1=TruckKey&SortOrder_1=ASC";
string URLString = URL + "?" + url_parameter;
resp = validation.getUrlApiResponse(URLString, APIName);
XmlDocument xmldoc = new XmlDocument();
xmldoc.LoadXml(resp); // use the .Load() method - not .LoadXml() !!
// get a list of all <Contact> nodes
XmlNodeList driverKey = xmldoc.SelectNodes("/result/data/row");
Participant
1231 Points
375 Posts
Re: Avoid duplicate data from api
Jan 09, 2015 03:33 PM|IbrahimIslam|LINK
You can just disable the button once the button is clicked.
Member
82 Points
263 Posts
Re: Avoid duplicate data from api
Jan 10, 2015 12:11 AM|binumon03|LINK
HI IbrahimIslam,
As per my application requirment i can't disable button
Participant
1231 Points
375 Posts
Re: Avoid duplicate data from api
Jan 10, 2015 03:47 AM|IbrahimIslam|LINK
Then what you can do is add another property to your Response model like public bool ResponseDone { get; set; } which will be set to true from your method. Then in client you can store the value of this property and before a button click, check whether it is false or not. If false you make the request to server otherwise return.
Member
82 Points
263 Posts
Re: Avoid duplicate data from api
Jan 10, 2015 05:32 AM|binumon03|LINK
Hi Ibrahim
I mean my search criteria will change. then i need to again want to go api.
Participant
1231 Points
375 Posts
Re: Avoid duplicate data from api
Jan 10, 2015 05:53 AM|IbrahimIslam|LINK
I am not sure I understand what you mean. But if my previous idea does not work for you (client side) then maybe you can store the flag in server side like in database or cache store and read from there whether you should response or not.