Hello ,
The project work very well but am confusing when i SET RadioButtonList ALL !!!
When i update someone i get update so when i change to other section list like second or third etc.... not saving , i checked SQL server nothing change
Even i change both Dropdown (yellow d1 / d2) not update and saving someone tell me what the wrong is
HTML : First RadioButtonList
<asp:RadioButtonList ID="rblCountries" runat="server" AutoPostBack="true" OnSelectedIndexChanged="rblCountries_SelectedIndexChanged"
RepeatDirection="Horizontal" RepeatLayout="Flow" BorderStyle="Solid"
ValidationGroup="Select" EnableTheming="True"
Width="100%" BorderColor="Black" BorderWidth="4px"
Font-Names="Arial" Font-Size="X-Large" CssClass="auto-style90"
Font-Bold="True">
<asp:ListItem Value="">All</asp:ListItem>
<asp:ListItem Selected="True">الادارة</asp:ListItem>
<asp:ListItem Text="المالى" Value="المالى"></asp:ListItem>
<asp:ListItem>السكرتارية</asp:ListItem>
<asp:ListItem Text="الشئون الهندسية " Value="الشئون الهندسية"></asp:ListItem>
</asp:RadioButtonList>
<asp:GridView ID="GridView1" runat="server" OnRowDataBound="OnRowDataBound" AlternatingRowStyle-BackColor="white" AutoGenerateColumns="False" CssClass="Grid" Font-Names="Arial" Font-Size="11pt" DataKeyNames="Id" ShowHeaderWhenEmpty="True" Style="font-size: medium" Width="100%" BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Horizontal">
<AlternatingRowStyle BackColor="#CCCCCC"></AlternatingRowStyle>
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="checkAll" runat="server" Checked="True" onclick="checkAll(this);" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" onclick="Check_Click(this)" Checked='<%# Eval("IsSelected2") %>' />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" Width="5px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="المجموعة">
<ItemTemplate>
<asp:Label ID="lblCountry" runat="server" Text='<%# Eval("groups") %>' Visible="false" />
<asp:DropDownList ID="ddlCountries" runat="server" BackColor="#FFFFCC" Font-Size="Large">
<asp:ListItem Text=""></asp:ListItem>
<asp:ListItem Text="الاشرافيين" Value="الاشرافيين"></asp:ListItem>
<asp:ListItem Text="المالى" Value="المالى"></asp:ListItem>
<asp:ListItem Text="السكرتارية" Value="السكرتارية"></asp:ListItem>
</asp:DropDownList>
<br />
<asp:Label ID="lblCountry2" runat="server" Text='<%# Eval("groups2") %>' Visible="false" />
<asp:DropDownList ID="ddlCountries2" runat="server" BackColor="#FFFFCC" Font-Size="Large">
<asp:ListItem Text=""></asp:ListItem>
<asp:ListItem Text="الاشرافيين" Value="الاشرافيين"></asp:ListItem>
<asp:ListItem Text="المالى" Value="المالى"></asp:ListItem>
<asp:ListItem Text="السكرتارية" Value="السكرتارية"></asp:ListItem>
<asp:ListItem Text="الشئون الهندسية أ" Value="الشئون الهندسية أ"></asp:ListItem>
</asp:DropDownList>
<br />
<asp:Button Text="Update" ID="btnUpdate" runat="server" OnClick="Update" Font-Bold="True" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ملاحظات">
<ItemTemplate>
<asp:Label ID="neworderdatatxt" Text='<%# Eval("neworderdata2") %>' runat="server" ForeColor="Red" Font-Size="Medium" />
<br />
<asp:Label ID="notemedicaltxt" Text='<%# Eval("notemedical") %>' runat="server" />
<br />
<asp:Label ID="LabelNamefile2" Text='<%# Eval("Namefile2") %>' runat="server" Visible="False" />
<asp:LinkButton ID="lnkDownload2" runat="server" Text="المرفقات" OnClick="DownloadFile2"
CommandArgument='<%# Eval("Id") %>' Visible='<%# !string.IsNullOrEmpty(Eval("Namefile2").ToString()) ? true : false %>'></asp:LinkButton>
</ItemTemplate>
<ItemStyle Width="100px" HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
<asp:BoundField DataField="blockrasme" >
<ItemStyle BackColor="White" Font-Size="2pt" ForeColor="White" Width="2px" />
</asp:BoundField>
</Columns>
</asp:GridView>
private void BindGridView()
{
try
{
string country = rblCountries.SelectedItem.Value;
string sql = "SELECT * FROM Table_infoname WHERE markazel3mal=@markazel3mal OR @markazel3mal = '' ORDER BY [OPkdamat], [OPnqlyat] DESC";
string constr = ConfigurationManager.ConnectionStrings["kankonConnectionString"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand(sql))
{
cmd.Parameters.AddWithValue("@markazel3mal", country);
cmd.Connection = con;
using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
{
using (DataTable dt = new DataTable())
{
sda.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
}
BindLocation();
}
}
}
catch (Exception)
{
}
}