开发者

How to Bind Sql DataSource using code?

I have sql dataSource which i have binded with gridview.

where i have column name Rate where i am using ajax rating through that i am updating value in to data base and i also want to show that value after updation.

but its not showing updatede value untill page refresh.

<ItemTemplate>
    <table border="0" cellpadding="0" cellspacing="0" width="auto">
        <tr style="width:150px;" valign="top" &开发者_如何学JAVAgt;
            <td style="height:30px;">
            <asp:Label ID="lblTotalRate" runat="server" 
                    Text='<%#DataBinder.Eval(Container.DataItem, "TotalRate")%>'></asp:Label>

            </td>
        </tr>   
        <tr style="width:150px;" valign="top" >
            <td style="height:30px;">
                <asp:UpdatePanel ID="updtpnlTweet" runat="server">
                    <ContentTemplate>
                        <cc1:Rating ID="rateTweet" runat="server" CurrentRating='<%# Bind("Rating") %>' 
                            EmptyStarCssClass="empatyStarRating" FilledStarCssClass="filledStarRating" 
                            MaxRating="5" onchanged="rateTweet_Changed" StarCssClass="ratingStar" 
                            WaitingStarCssClass="savedStarRating">
                        </cc1:Rating>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
    </table>
</ItemTemplate>


This example miss code that forces UpdatePanel be changed. By default it would intercept any child posyback events. So just set Rating's AutoPostBack="true"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜