2
Answers

Passing XML to be styled from SQL Database xml field

Photo of Tumelo Molefe

Tumelo Molefe

9y
359
1
I have an application that retrieves data from a webservice and then saves to SQL database and then now i need to retrive that data and display it in a Web page and I want to style it accordingly. I get to a problem as some of the xml nodes repeat themselves and they have no ids and i was wondering if there is a work around to this when using softeware as Altova StyleVision. Sample XML
 
<ConsumerInfoNO05 xmlns="https://secure.transunion.co.za/TUBureau"><RecordSeq>01</RecordSeq><Part>001</Part><PartSeq>01</PartSeq><ConsumerNo>645511420</ConsumerNo><Surname>ROBERTSON</Surname><Forename1>NEIL</Forename1><Forename2>EDWIN</Forename2><Forename3 /><Title>MR</Title><Gender>M</Gender><NameInfoDate>20151123</NameInfoDate><DateOfBirth>19500717</DateOfBirth><IdentityNo1>5007175043082</IdentityNo1><IdentityNo2 /><MaritalStatusCode>D</MaritalStatusCode><MaritalStatusDesc>DIVORCED</MaritalStatusDesc><Dependants>02</Dependants><SpouseName1 /><SpouseName2 /><TelephoneNumbers>H(011)4531247 B(011)6146570</TelephoneNumbers><DeceasedDate>00000000</DeceasedDate><CellNumber>0767300689</CellNumber><EMail /></ConsumerInfoNO05><ConsumerTelephoneHistoryNW01 xmlns="https://secure.transunion.co.za/TUBureau"><ConsumerNo>645511420</ConsumerNo><WorkNumbers><PhoneNumber><AreaCode>011</AreaCode><Number>6146570</Number><Date>20090619</Date><Years>0006</Years></PhoneNumber><PhoneNumber><AreaCode>011</AreaCode><Number>4524800</Number><Date>20021024</Date><Years>0006</Years></PhoneNumber><PhoneNumber><AreaCode /><Number /><Date>00000000</Date><Years>0000</Years></PhoneNumber></WorkNumbers><HomeNumbers><PhoneNumber><AreaCode>011</AreaCode><Number>4531247</Number><Date>20100614</Date><Years>0005</Years></PhoneNumber><PhoneNumber><AreaCode /><Number /><Date>00000000</Date><Years>0000</Years></PhoneNumber><PhoneNumber><AreaCode /><Number /><Date>00000000</Date><Years>0000</Years></PhoneNumber></HomeNumbers><CellNumbers><PhoneNumber><Number>00000000000767300689</Number><Date>20100614</Date><Years>0005</Years></PhoneNumber><PhoneNumber><Number>00000000000000000000</Number><Date>00000000</Date><Years>0000</Years></PhoneNumber><PhoneNumber><Number>00000000000000000000</Number><Date>00000000</Date><Years>0000</Years></PhoneNumber></CellNumbers></ConsumerTelephoneHistoryNW01><EchoData0001 xmlns="https://secure.transunion.co.za/TUBureau"><SubscriberCode>02224</SubscriberCode><ClientReference /><BranchNumber /><BatchNumber /></EchoData0001><EmploymentNM04 xmlns="https://secure.transunion.co.za/TUBureau"><EmploymentNM04><RecordSeq>01</RecordSeq><Part>001</Part><PartSeq>01</PartSeq><ConsumerNo>645511420</ConsumerNo><InformationDate>20100614</InformationDate><Occupation /><EmployerName>COLLIES CLOTHING</EmployerName><EmploymentPeriod>00</EmploymentPeriod></EmploymentNM04><EmploymentNM04><RecordSeq>02</RecordSeq><Part>001</Part><PartSeq>01</PartSeq><ConsumerNo>645511420</ConsumerNo><InformationDate>20031221</InformationDate><Occupation>MANAGER</Occupation><EmployerName>MASS SUPPLY CLOTHING</EmployerName><EmploymentPeriod>00</EmploymentPeriod></EmploymentNM04><EmploymentNM04><RecordSeq>03</RecordSeq><Part>001</Part><PartSeq>01</PartSeq><ConsumerNo>645511420</ConsumerNo><InformationDate>20000622</InformationDate><Occupation>DIRECTOR</Occupation><EmployerName /><EmploymentPeriod>00</EmploymentPeriod></EmploymentNM04></EmploymentNM04> 
 
 

Answers (2)

1
Photo of Vinay Singh
NA 5.9k 126.2k 8y
Hi
you can use jQuery code to perform the operation
Js Function
  1. <script src="http://code.jquery.com/jquery-2.1.4.min.js" type="text/javascript"></script>
  2. <script language="javascript">
  3. function EnableButton(){
  4. $('#Button1').prop("disabled",false);
  5. }
  6. function DisableButton(){
  7. $('#Button1').prop("disabled",true);
  8. }
  9. function ValidateContent()
  10. {
  11. if($('#txtFromDate').attr('value')=="" && $('#txtToDate').attr('value')=="")
  12. {
  13. DisableButton();
  14. }
  15. else
  16. {
  17. EnableButton();
  18. }
  19. }
  20. </script>
Now on textbox event
  1. FromDate: @Html.TextBox("txtFromDate", new{@onblur="javascript:ValidateContent();"})
  2. ToDate: @Html.TextBox("txtTodate", new{@onblur="javascript:ValidateContent();"})
for detail have a look of the link

http://www.aspdotnet-pools.com/2015/09/disable-and-enable-button-using-jquery.html