C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

datalist problem


Posted Date: 05 Jul 2008      Posted By: samatha g      Member Level: Gold     Points: 1   Responses: 2



iam using radiobuttonlist control in my datalist.so each radiobuttonlist has 5 radiobuttons.(named 1,2,3,4,5)

my doubt was:

if i will select radiobutton1 in first datalist item that should be disabled in remaining all items,how is it possible?pls help me soon......





Responses

Author: Rathi    05 Jul 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 0

hai : samatha

pls give me ur code........yarr



Author: saikrishna alladi    05 Jul 2008Member Level: SilverRating: 2 out of 52 out of 5     Points: 6

hi rathi.. this is my code...


<asp:DataList ID="MyDataList" runat="server" RepeatColumns="1" OnEditCommand="MyDataList_Edit" Width="685px" OnCancelCommand="MyDataList_Cancel" OnUpdateCommand="MyDataList_Update" >
<ItemTemplate>
<table cellpadding="10" style="font: 10pt verdana">
<tr>
<td width="1" />
<td valign="top">
</td>
<td valign="top">
<b>ProjId: </b><%# DataBinder.Eval(Container.DataItem, "Projid") %><br>
<b>Title: </b><%# DataBinder.Eval(Container.DataItem, "projtitle") %><br>
<b>Project Type: </b><%# DataBinder.Eval(Container.DataItem, "projtype") %><br>
<b>Summary: </b><%# DataBinder.Eval(Container.DataItem, "summary") %><br>
<b>Supervisor: </b><%# DataBinder.Eval(Container.DataItem, "supervisor") %><br />
<b>Rating:</b><%# DataBinder.Eval(Container.DataItem, "Rating") %>
<p>
<asp:linkbutton ID="Linkbutton1" CommandName="Edit" runat="server">Edit
</asp:linkbutton>
</td>
</tr>
</table>
</ItemTemplate>
<EditItemTemplate>

<table cellpadding="10" style="font: 10pt verdana">
<tr>
<td width="1"/>
<td valign="top">
</td>
<td valign="top">
<b>ProjId: </b><asp:Label runat="server" ID="lblprojid" Text='<%# DataBinder.Eval(Container.DataItem, "Projid") %>' ></asp:Label><br>
<b>Title: </b><%# DataBinder.Eval(Container.DataItem, "projtitle") %><br>
<b>Project Type: </b><%# DataBinder.Eval(Container.DataItem, "projtype") %><br>
<b>Summary: </b><%# DataBinder.Eval(Container.DataItem, "summary") %><br>
<b>Supervisor: </b><%# DataBinder.Eval(Container.DataItem, "supervisor") %><br />
<b>Rating: </b><%--<input id="edit_price" type="text" value='<%# DataBinder.Eval(Container.DataItem, "Rating") %>' runat="server"/>--%>

<asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal" >
<asp:ListItem Text="1"></asp:ListItem>
<asp:ListItem Text="2"></asp:ListItem>
<asp:ListItem Text="3"></asp:ListItem>
<asp:ListItem Text="4"></asp:ListItem>
<asp:ListItem Text="5"></asp:ListItem>
</asp:RadioButtonList>

<p>
<asp:linkbutton ID="Linkbutton2" CommandName="Update" runat="server">Update</asp:linkbutton>
<asp:linkbutton ID="Linkbutton3" CommandName="Cancel" runat="server">Cancel</asp:linkbutton>
</td>



Label lbl = ((Label)e.Item.FindControl("lblprojid"));
string projid = lbl.Text;

RadioButtonList rbl = ((RadioButtonList)e.Item.FindControl("RadioButtonList1"));
string sel=rbl.SelectedValue;

con.Close();
cmd.Connection = con;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "Update UserRequests Set Rating='" + sel + "' where mailid='" + Session["username"].ToString() + "' and projid='" + projid + "'";
con.Open();
cmd.ExecuteNonQuery();
con.Close();


MyDataList.EditItemIndex = -1;
// PopulateList();
BuildList(mailid);
</tr>
</table>

</EditItemTemplate>
</asp:DataList>

Thanks & Regards
Saikrishna Alladi



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : Repeater problem
Previous : How to add image to gridview dyanmically in asp.net
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use