how to bind list collection value to textbox

Posted by Raj_Chennai under ASP.NET on 3/15/2012 | Points: 10 | Views : 2836 | Status : [Member] | Replies : 1
i have created webservice in which i have used list collection and it will return multiple values.I need to bind those values to texboxes

raj


Responses

Posted by: Shravankomirineni on: 3/22/2012 [Member] Starter | Points: 25

Up
0
Down
You cand bind the list to textboxes in two ways
i)
txtdata1.text=listresult[0].examplevalue.tostring();
ii)
put all your text boxes in a gridview according with your design using item templates like below example
then bind your list collection to that gridview .
gridview.datasoure=lstresult;
gridvieew.databind();
ex: <asp:GridView ID="GrdLecture" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<div >
<div class="body_content_main_heading">
<asp:LinkButton ID="DiscussionTitleLinkButton" runat="server" Text='<%# Bind("Title") %>'
class="body_content_main_heading"></asp:LinkButton>
</div>
<div class="body_content_main_description">
<asp:Label ID="DescriptionLabel" runat="server" Text='<%# Bind("Description") %>'
class="body_content_main_description"></asp:Label>
</div>
<div id="threadbottom">
Author: <asp:Label ID="lblSuthor" runat="server" Text='<%# Bind("Author") %>' ForeColor="#00749E" ></asp:Label>
| DatedPosted: <asp:Label ID="TimeLabel" runat="server" Text='<%# Bind("CreatedTime") %>'/>
<ajaxToolkit:Rating runat="server" MaxRating="5" CurrentRating='<%# Bind("RateCount") %>' ID="ajaxRating" StarCssClass="ratingStar"
WaitingStarCssClass="savedRatingStar"
FilledStarCssClass="filledRatingStar"
EmptyStarCssClass="emptyRatingStar" ReadOnly="true" ></ajaxToolkit:Rating>
</div>
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

Raj_Chennai, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response