Hi,
On my asp.net page I have an html form. I've set runat attribute to server
and filled it with server controls. All settings
are as I like them.
So here's the problem: when I perform a search for the first time, everythin
g works perfectly. If I make any changes to the
controls in the form and resubmit the page, nothing changes. That is, viewi
ng the querystring, not a single value is altered
despite my doing so in the form itself.
Is there some problem with the html form? I can't for the life of me figure
this out. Any help would be greatly appreciated.
Thanks,
RoshawnHi,
Roshawn wrote:
> Hi,
> On my asp.net page I have an html form. I've set runat attribute to
> server and filled it with server controls. All settings are as I like
> them.
> So here's the problem: when I perform a search for the first time,
> everything works perfectly. If I make any changes to the controls in
> the form and resubmit the page, nothing changes. That is, viewing the
> querystring, not a single value is altered despite my doing so in the
> form itself.
> Is there some problem with the html form? I can't for the life of me
> figure this out. Any help would be greatly appreciated.
> Thanks,
> Roshawn
We'll need to see some code. Please post an extract of your code able to
reproduce the problems, stripping what is not necessary.
Greetings,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Hi Laurent. Sorry for the delayed response, been busy. As you requested, h
ere's some code.
HTML Form
<form runat="server" enableviewstate="false">
<label for="q">Search:</label><br/>
<input type="text" name="q" id="q" maxlength="100" /><br/>
<label for="sz">Shoe Size:</label><br/>
<asp:dropdownlist id="sz" runat="server" enableviewstate="false">
<asp:listitem value="-24">Any</asp:listitem>
<asp:listitem value="42802">5 & Smaller</asp:listitem>
<asp:listitem value="37090">6</asp:listitem>
<asp:listitem value="22806">7</asp:listitem>
<asp:listitem value="1032">8</asp:listitem>
'more listitems go here
</asp:dropdownlist><br/>
<label for="tp">Type:</label><br/>
<asp:dropdownlist runat="server" id="tp" enableviewstate="false">
<asp:listitem value="-24">Any</asp:listitem>
<asp:listitem value="2293">Athletic</asp:listitem>
<asp:listitem value="31920">Athletic-Inspired</asp:listitem>
</asp:dropdownlist><br/>
<label for="cd">Condition:</label><br/>
<asp:dropdownlist id="cd" runat="server" enableviewstate="false">
<asp:listitem value="-24">Any</asp:listitem>
<asp:listitem value="31919">New</asp:listitem>
</asp:dropdownlist><br/>
<input type="submit" id="submit" value="Search" />
</form>
Code to handle form (note that this uses the eBay XML API; it works as expec
ted and is called in the Page_Load event)
Private Sub GetShoeResults()
Dim hp As New MyHelper() 'declared variable for the MyHelper class for auxil
lary functions
Dim shoe As Shoe = New Shoe()'custom class
Dim sb As New StringBuilder("<?xml version=""1.0"" encoding=""utf-8""?>")
With sb
.Append("<GetSearchResultsRequest xmlns=""urn:ebay:apis:eBLBaseComponents"">
<RequesterCredentials><eBayAuthToken>" &
ConfigurationManager.AppSettings("Token") & "</eBayAuthToken></RequesterCred
entials>")
.Append("<CategoryID>63850</CategoryID><DetailLevel>ReturnAll</DetailLevel>"
)
If Request.QueryString("q") <> "" Then
.Append("<Query>" & Request.QueryString("q") & "</Query>")
End If
.Append("<SearchRequest><AttributeSetID>22</AttributeSetID><ProductFinderID>
22</ProductFinderID>")
'for the Size Parameter
If Request.QueryString("sz") <> "" Then
'turn off all selected items
For i = 0 To Me.sz.Items.Count - 1
Me.sz.Items(i).Selected = False
Next
.Append("<SearchAttributes><AttributeID>53</AttributeID><ValueList><ValueID>
" & Request.QueryString("sz") &
"</ValueID></ValueList></SearchAttributes>")
Dim item As ListItem
For Each item In Me.sz.Items
If item.Value = Request.QueryString("sz") Then
shoe.Size_ID = item.Value
shoe.Size = item.Text
item.Selected = True
Exit For
End If
Next
End If
'for the Type Parameter
If Request.QueryString("tp") <> "" Then
'turn off all selected items
For i = 0 To Me.tp.Items.Count - 1
Me.tp.Items(i).Selected = False
Next
.Append("<SearchAttributes><AttributeID>54</AttributeID><ValueList><ValueID>
" & Request.QueryString("tp") &
"</ValueID></ValueList></SearchAttributes>")
Dim item As ListItem
For Each item In Me.tp.Items
If item.Value = Request.QueryString("tp") Then
shoe.Type_ID = item.Value
shoe.Type = item.Text
item.Selected = True
Exit For
End If
Next
End If
'for the Condition Parameter
If Request.QueryString("cd") <> "" Then
'turn off all selected items
For i = 0 To Me.cd.Items.Count - 1
Me.cd.Items(i).Selected = False
Next
.Append("<SearchAttributes><AttributeID>94</AttributeID><ValueList><ValueID>
" & Request.QueryString("cd") &
"</ValueID></ValueList></SearchAttributes>")
Dim item2 As ListItem
For Each item2 In Me.cd.Items
If item2.Value = Request.QueryString("cd") Then
shoe.Condition_ID = item2.Value
shoe.Condition = item2.Text
item2.Selected = True
Exit For
End If
Next
End If
'Add Pagination in case a page number is returned in the querystring
.Append("<Pagination><EntriesPerPage>10</EntriesPerPage></Pagination></GetSe
archResultsRequest>")
End With
Try
Me.Xml1.DocumentContent = hp.CreateHeaders(sb.ToString())'call to eBay
Dim ext As New XsltArgumentList()
ext.AddExtensionObject("urn:Shoes", shoe)
Me.Xml1.TransformArgumentList = ext
Me.Xml1.TransformSource = "search.xslt"
Catch ex As WebException
'handle errors here
End Try
End Sub
I hope this helps you help me. Thanks for being interested. :-)
Roshawn
No comments:
Post a Comment