<script type="text/javascript">
function RadiocheckUnCheck(id) {
var TotalRows = document.getElementById('<%=hfTotalId.ClientID %>');
document.getElementById('<%=hfNewSelected.ClientID%>').value = id;
var str = id;
var LastChar = str.charAt(str.length - 1);
var subid = str.substring(0, str.length - 1);
for (j = 1; j < 5; j++) {
if (id != subid + j.toString()) {
document.getElementById(subid + j.toString()).checked = false;
}
}
for (var i = 2; i < TotalRows.value + 2; i++) {
if (i < 10) {
if (document.getElementById('ctl00_ContentPlaceHolder1_GridView1_ctl0' + i + '_RbtnPriorit' + LastChar).id == id) {
document.getElementById('ctl00_ContentPlaceHolder1_GridView1_ctl0' + i + '_RbtnPriorit' + LastChar).checked = true;
}
else if (document.getElementById('ctl00_ContentPlaceHolder1_GridView1_ctl0' + i + '_RbtnPriorit' + LastChar).id != id) {
document.getElementById('ctl00_ContentPlaceHolder1_GridView1_ctl0' + i + '_RbtnPriorit' + LastChar).checked = false;
}
}
else if (i > 10) {
if (document.getElementById('ctl00_ContentPlaceHolder1_GridView1_ctl' + i + '_RbtnPriorit' + LastChar).id == id) {
document.getElementById('ctl00_ContentPlaceHolder1_GridView1_ctl' + i + '_RbtnPriorit' + LastChar).checked = true;
}
else if (document.getElementById('ctl00_ContentPlaceHolder1_GridView1_ctl' + i + '_RbtnPriorit' + LastChar).id != id) {
document.getElementById('ctl00_ContentPlaceHolder1_GridView1_ctl' + i + '_RbtnPriorit' + LastChar).checked = false;
}
}
}
return false;
}
</script>
HTML------------------------
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
onrowdatabound="GridView1_RowDataBound" Width="100%" Font-Names="Trebuchet MS"
Font-Size="10pt">
<RowStyle HorizontalAlign="Center" />
<Columns>
<asp:TemplateField HeaderText="SL.No.">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#Container.DataItemIndex+1 %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</EditItemTemplate>
<ItemStyle Width="60px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Vendor">
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("vender") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("vender") %>'></asp:TextBox>
</EditItemTemplate>
<ItemStyle HorizontalAlign="Left" />
<ItemStyle Width="300px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Priority_1">
<ItemTemplate>
<asp:RadioButton ID="RbtnPriorit1" runat="server" onclick="RadiocheckUnCheck(this.id);" />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Priority_2">
<ItemTemplate>
<asp:RadioButton ID="RbtnPriorit2" runat="server" onclick="RadiocheckUnCheck(this.id);" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Priority_3">
<ItemTemplate>
<asp:RadioButton ID="RbtnPriorit3" runat="server" onclick="RadiocheckUnCheck(this.id);" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Priority_4">
<ItemTemplate>
<asp:RadioButton ID="RbtnPriorit4" runat="server" onclick="RadiocheckUnCheck(this.id);" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Priority" Visible="False">
<EditItemTemplate>
<asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("priority") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("priority") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<HeaderStyle BackColor="#CCCCCC" Height="22pt" />
</asp:GridView>
<asp:HiddenField ID="hfTotalId" runat="server" />
<asp:HiddenField ID="hfNewSelected" runat="server" />
No comments:
Post a Comment