Value of boolean cell in gridview to shown in a radio button - c#

I have a Boolea(bit) value in database and i shown it in Grid View in the cell no. 2 like this
MyGrdView.SelectedRow.Cells[2] // for any row selected this cell have a boolean value 0 or 1
The GridView in a View 1 in Multiview control
I need in another View (view2), i can shown this value in check box, so if the boolean cell in gridview have 0, the check box checked and for 1 the check box unchecked
ASP Code:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:MultiView ID="LocationsMultiView" runat="server" ActiveViewIndex="0">
<asp:View ID="View1" runat="server">
<div>
<div class="EU_TableScroll" id="showData" style="display: block">
<table class="auto-style1">
<tr>
<td>
<asp:Button ID="Btn_ShowReminders" runat="server" Text="Show Reminders" OnClick="Btn_ShowReminders_Click" />
<asp:Button ID="Btn_EditReminder" runat="server" Text="Edit Reminder" Enabled="False" OnClick="Btn_EditReminder_Click" />
<asp:Button ID="Btn_RemoveReminder" runat="server" Enabled="False" OnClick="Btn_RemoveReminder_Click" Text="Delete Reminder" />
</td>
</tr>
<tr>
<td>
<asp:Label ID="Lbl_Error" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:GridView ID="Grd_Reminders" runat="server" CssClass="EU_DataTable" GridLines="Horizontal" OnSelectedIndexChanged="Grd_Reminders_SelectedIndexChanged">
<Columns>
<asp:ButtonField ButtonType="Button" CommandName="Select" HeaderText="Select" ShowHeader="True" Text=">>>" />
</Columns>
</asp:GridView>
</td>
</tr>
<tr>
<td>
<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
<asp:Image ID="Image1" runat="server" ImageUrl="~/img/ajax-loader.gif" />
</ProgressTemplate>
</asp:UpdateProgress>
</td>
</tr>
</table>
</div>
</div>
</asp:View>
<asp:View ID="View2" runat="server">
<table class="auto-style1">
<tr>
<td colspan="3">
<asp:Label ID="Lbl_EditRemTitle" runat="server" Text="Edit Reminder"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Lbl_Edit_Title" runat="server" Text="Title"></asp:Label>
</td>
<td>
<asp:TextBox ID="Txt_EditTitle" runat="server"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="RequiredFieldValidator" ValidationGroup="g1" ControlToValidate="Txt_EditTitle">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Lbl_Edit_Content" runat="server" Text="Content"></asp:Label>
</td>
<td>
<asp:TextBox ID="Txt_Edit_Content" runat="server"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Lbl_Edit_Desc" runat="server" Text="Description"></asp:Label>
</td>
<td class="auto-style2">
<asp:TextBox ID="Txt_Edit_Description" runat="server" TextMode="MultiLine"></asp:TextBox>
</td>
<td class="auto-style2"> </td>
</tr>
<tr>
<td>
<asp:Label ID="Lbl_Edit_TurnOn" runat="server" Text="Turn On"></asp:Label>
</td>
<td>
<asp:CheckBox ID="CheckBox1" runat="server" />
</td>
<td> </td>
</tr>
<tr>
<td>
<asp:Label ID="Lbl_Edit_Alw" runat="server" Text="Always"></asp:Label>
</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>
<asp:Label ID="Lbl_Edit_Public" runat="server" Text="Public"></asp:Label>
</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>
<asp:Label ID="Lbl_Edit_Radius" runat="server" Text="Radius"></asp:Label>
</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="3">
<asp:Label ID="Lbl_Edit_Msg" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:UpdateProgress ID="UpdateProgress2" runat="server">
</asp:UpdateProgress>
</td>
</tr>
<tr>
<td colspan="3">
<asp:Button ID="Button1" runat="server" Text="Save" ValidationGroup="g1" />
<asp:Button ID="Btn_Cancel_Edit" runat="server" OnClick="Btn_Cancel_Edit_Click" Text="Cancel" />
</td>
</tr>
</table>
</asp:View>
</asp:MultiView>
</ContentTemplate>
CS Code:
public partial class webusercontrols_remindersctl : System.Web.UI.UserControl
{
Locations Lo = new Locations();
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if (Utilities.ReadFromCookie("logincookie", "user", Request) != null)
{
UserInfo UI = new UserInfo();
string userNameOnWB = Request.Cookies["logincookie"]["user"];
}
}
// Btn_ShowReminders_Click(null, null);
}
protected void Grd_Reminders_SelectedIndexChanged(object sender, EventArgs e)
{
Btn_RemoveReminder.Enabled = true;
Grd_Reminders.SelectedRow.BackColor = Color.FromName("#E56E94");
Btn_RemoveReminder.Enabled = true;
Btn_EditReminder.Enabled = true;
}
protected void Btn_ShowReminders_Click(object sender, EventArgs e)
{
Locations loc = new Locations();
string UserName = Request.Cookies["logincookie"]["user"];
Grd_Reminders.DataSource = loc.GetRemindersForUser(UserName);
Grd_Reminders.DataBind();
Grd_Reminders.SelectedIndex = -1;
Btn_RemoveReminder.Enabled = false;
Btn_EditReminder.Enabled = false;
Lbl_Error.Text = String.Empty;
}
protected void Btn_RemoveReminder_Click(object sender, EventArgs e)
{
int ID = Int32.Parse((Grd_Reminders.SelectedRow.Cells[1].Text).ToString());
if (Lo.RemoveLocations(ID))
{
Lbl_Error.Text = "Reminder Removed!";
}
else
{
Lbl_Error.Text = "Error Removing Reminder!";
}
Btn_RemoveReminder.Enabled = false;
Grd_Reminders.DataBind();
}
protected void Btn_EditReminder_Click(object sender, EventArgs e)
{
LocationsMultiView.ActiveViewIndex = 1;
if (Grd_Reminders.SelectedRow.Cells[5] != null)
Txt_EditTitle.Text = Grd_Reminders.SelectedRow.Cells[5].Text;
if (Grd_Reminders.SelectedRow.Cells[6] != null)
Txt_Edit_Content.Text = Grd_Reminders.SelectedRow.Cells[6].Text;
if (Grd_Reminders.SelectedRow.Cells[7] != null)
Txt_Edit_Description.Text = Grd_Reminders.SelectedRow.Cells[7].Text;
if (Grd_Reminders.SelectedRow.Cells[8] != null)
CheckBox1.Checked = Convert.ToBoolean(Grd_Reminders.SelectedRow.Cells[8]);
}
protected void Btn_Cancel_Edit_Click(object sender, EventArgs e)
{
LocationsMultiView.ActiveViewIndex = 0;
}
}

Related

Compare User Input to AD Group for login

I have a simple login page that takes a Username and a password and but I'm not sure how to take those values and compare them to an AD Group to allow only members of that group to login.
aspx
<table align="center">
<tr>
<td align="Right">
<asp:Label ID="lblID" runat="server" Text="ID: "></asp:Label>
</td>
<td align="center">
<asp:TextBox ID="txtID" runat="server" Width="200px"></asp:TextBox>
</td>
</tr>
<tr>
<td align="Right">
<asp:Label ID="lblPass" runat="server" Text="Password: "></asp:Label>
</td>
<td align="center">
<asp:TextBox ID="txtPass" runat="server" Width="200px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
</td>
<td align="center">
<asp:Button ID="btnLogin" runat="server" Text="Login" OnClick="btnLogin_Click" />
</td>
</tr>
<table>
aspx.cs
protected void btnLogin_Click(object sender, EventArgs e)
{
{
if (/* valid Username and Password */)
{
Response.Redirect("PAGE.aspx");
}
else
{
lblInvalid.Visible = true;
}
}

Show / Hide GridView Columns in ASP.NET

I'm creating a web project in Visual Studio 2012 using C# which fetch data from database and shows in a grid-view. There are many number of columns in the database, which shows on the grid-view as it is. I want to make an option for the user to eliminate unwanted columns using check-boxes and after checking, on a button click it must update.
Till now I've tried doing the code shown below but no luck.
protected void btn_modify_Click(object sender, EventArgs e)
{
if (CheckBox2.Checked)
{
this.GridView1.Columns[2].Visible = false;
}
else
{
this.GridView1.Columns[2].Visible = true;
}
}
.aspx code is as follows.
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="Reporting Mopdule.aspx.cs" Inherits="WebApplication1.Reporting_Mopdule" %>
<%# Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajax" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.newStyle1 {
font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif;
font-size: x-large;
}
.newStyle2 {
font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif;
color: #0000FF;
}
.newStyle3 {
font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif;
color: #0000FF;
}
.newStyle4 {
color: #0000FF;
font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif;
}
.newStyle5 {
font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif;
color: #0000FF;
}
.auto-style3 {
width: 122px;
}
.newStyle6 {
font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif;
font-size: x-large;
}
.newStyle7 {
position: absolute;
}
.auto-style5 {
width: 117px;
}
.auto-style7 {
width: 59px;
}
.auto-style8 {
width: 65px;
}
.newStyle8 {
position: absolute;
}
.newStyle9 {
position: absolute;
}
.auto-style9 {
width: 305px;
}
.newStyle10 {
position: absolute;
}
.newStyle11 {
text-decoration: underline;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<ajax:ToolkitScriptManager ID="toolkit1" runat="server"></ajax:ToolkitScriptManager>
</div>
<table style="width:100%;">
<caption style="width: 478px">
<asp:Label ID="Label6" runat="server" CssClass="newStyle6" Font-Bold="True" Text="Report On Energy Development"></asp:Label>
</caption>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
<table style="width: 69%; margin-top: 0px; height: 303px;">
<caption>
<br />
</caption>
<tr>
<td class="auto-style5">
<asp:Label ID="Label1" runat="server" CssClass="newStyle2" Text="State"></asp:Label>
</td>
<td>
<asp:Label ID="Label2" runat="server" CssClass="newStyle3" Text="Cluster"></asp:Label>
</td>
<td class="auto-style9">
<asp:Label ID="Label3" runat="server" CssClass="newStyle4" Text="DateFrom : "></asp:Label>
</td>
<td class="auto-style3">
<asp:Label ID="Label4" runat="server" CssClass="newStyle5" Text="DateTo :"></asp:Label>
</td>
<td class="auto-style7"> </td>
<td class="auto-style8">
<asp:Button ID="Button3" runat="server" Height="34px" OnClick="Button3_Click" Text="Export To Excel" Width="138px" />
</td>
<td class="auto-style8" rowspan="11">
<asp:Panel ID="Panel1" runat="server" Width="224px">
<table style="width: 99%;">
<tr>
<td>
<asp:CheckBox ID="CheckBox17" runat="server" AutoPostBack="True" OnCheckedChanged="CheckBox17_CheckedChanged" Text="All" />
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox2" runat="server" Text="SerialNo" OnCheckedChanged="CheckBox2_CheckedChanged" />
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox11" runat="server" Text="Load_Enegy_Cumulative" />
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox3" runat="server" Text="SiteName" />
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox12" runat="server" Text="Mains_Energy_Daily" />
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox4" runat="server" Text="SiteId" />
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox13" runat="server" Text="Mains_Energy_Cumulative" />
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox5" runat="server" Text="State" />
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox14" runat="server" Text="Solar_Energy_Daily" />
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox6" runat="server" OnCheckedChanged="CheckBox6_CheckedChanged" Text="Cluster" />
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox15" runat="server" Text="Solar_Energy_Cumulative" />
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox7" runat="server" Text="Date" />
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox16" runat="server" Text="Generate_Date" />
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox8" runat="server" Text="Dg_Energy_Daily" />
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox9" runat="server" Text="Dg_Energy_Cumulative" />
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox10" runat="server" Text="Load_Energy_Daily" />
</td>
</tr>
</table>
</asp:Panel>
</td>
</tr>
<tr>
<td class="auto-style5">
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
</asp:DropDownList>
</td>
<td>
<asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True">
</asp:DropDownList>
</td>
<td class="auto-style9">
<asp:TextBox ID="TextBox1" runat="server" style="margin-top: 0px" OnTextChanged="TextBox1_TextChanged"></asp:TextBox>
<ajax:CalendarExtender ID="TextBox1_CalendarExtender" runat="server" Enabled="True" TargetControlID="TextBox1">
</ajax:CalendarExtender>
</td>
<td class="auto-style3">
<asp:TextBox ID="TextBox2" runat="server" OnTextChanged="TextBox2_TextChanged" ></asp:TextBox>
<ajax:CalendarExtender ID="TextBox2_CalendarExtender" runat="server" Enabled="True" TargetControlID="TextBox2">
</ajax:CalendarExtender>
</td>
<td class="auto-style7">
<asp:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_Click" />
</td>
<td class="auto-style8">
<asp:Button ID="Button4" runat="server" Height="30px" OnClick="Button4_Click" Text="Export To PDF" Width="139px" />
</td>
</tr>
<tr>
<td class="auto-style5">
</td>
<td>
</td>
<td class="auto-style9">
</td>
<td class="auto-style3">
<asp:TextBox ID="TextBox3" runat="server" AutoPostBack="True"></asp:TextBox>
</td>
<td class="auto-style7"> </td>
<td class="auto-style8">
<asp:Button ID="Button5" runat="server" OnClick="Button5_Click" Text="Hide" Width="44px" />
<asp:Button ID="Button6" runat="server" OnClick="Button6_Click" Text="Show" />
</td>
</tr>
<tr>
<td class="auto-style5">
</td>
<td>
</td>
<td class="auto-style9">
</td>
<td class="auto-style3">
</td>
<td class="auto-style7">
</td>
<td class="auto-style8">
<asp:Button ID="Button7" runat="server" Height="31px" OnClick="Button7_Click" Text="Modify Table" Width="139px"
/>
</td>
</tr>
<tr>
<td class="auto-style5"> </td>
<td> </td>
<td class="auto-style9"> </td>
<td class="auto-style3"> </td>
<td class="auto-style7"> </td>
<td class="auto-style8">
</td>
</tr>
<tr>
<td class="auto-style5"> </td>
<td> </td>
<td class="auto-style9"> </td>
<td class="auto-style3"> </td>
<td class="auto-style7"> </td>
<td class="auto-style8">
</td>
</tr>
<tr>
<td class="auto-style5"> </td>
<td> </td>
<td class="auto-style9"> </td>
<td class="auto-style3"> </td>
<td class="auto-style7"> </td>
<td class="auto-style8">
</td>
</tr>
<tr>
<td class="auto-style5"> </td>
<td> </td>
<td class="auto-style9"> </td>
<td class="auto-style3"> </td>
<td class="auto-style7"> </td>
<td class="auto-style8"> </td>
</tr>
<tr>
<td class="auto-style5">
</td>
<td>
</td>
<td class="auto-style9"> </td>
<td class="auto-style3"> </td>
<td class="auto-style7"> </td>
<td class="auto-style8"> </td>
</tr>
<tr>
<td class="auto-style5">
</td>
<td>
</td>
<td class="auto-style9">
</td>
<td class="auto-style3">
</td>
<td class="auto-style7">
</td>
<td class="auto-style8">
</td>
</tr>
<tr>
<td class="auto-style5">
</td>
<td>
</td>
<td class="auto-style9">
</td>
<td class="auto-style3">
</td>
<td class="auto-style7">
</td>
<td class="auto-style8">
</td>
</tr>
</table>
<table style="width:100%;">
<tr>
<td>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" CellPadding="3" Height="185px" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" Width="297px" AutoGenerateColumns="false" BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellSpacing="2">
<FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
<HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
<PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
<PagerTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" />
</PagerTemplate>
<RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#FFF1D4" />
<SortedAscendingHeaderStyle BackColor="#B95C30" />
<SortedDescendingCellStyle BackColor="#F1E5CE" />
<SortedDescendingHeaderStyle BackColor="#93451F" />
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</form>
</body>
</html>
In the below image you can see many check-boxes. I want the user to select what all columns they need by clicking on the check-boxes and only those columns be shown in the grid-view, after clicking the button "Modify Table".
You can use the following code
protected void btn_modify_Click(object sender, EventArgs e)
{
foreach (ListItem val in CheckBoxList.Items)
{
if (val.Checked)
{
this.GridView1.Columns[0].Visible = false;
.
.
.
}
else
{
this.GridView1.Columns[0].Visible = true;
}
}
}
try this,
Using column name you can achieve this.
<asp:GridView ID="GridView1" runat="server" CellPadding="3" Height="185px" Width="297px"
BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellSpacing="2">
<Columns>
<asp:BoundField HeaderText="ColumnName" DataField="ColumnName" />
<%--Add Boundfield as per your columns--%>
<asp:BoundField HeaderText="ColumnName" DataField="ColumnName" />
</Columns>
</asp:GridView>
Try this code inside row created event of your gridview:
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if(checkbox2.checked)
e.Row.Cells[2].Visible = false;
else
e.Row.Cells[2].Visible = true;
}
On Button click jus call the method which binds the grid
Dont remove the column: GridView1.Columns.RemoveAt(2);
protected void btn_modify_Click(object sender, EventArgs e)
{
GridView1.Columns[1].Visible = false;
GridView1.Columns[0].Visible = false;
if (CheckBox2.Checked)
{
TextBox3.Enabled = false;
//GridView1.Visible = false; --> Hides the whole Gridview
this.GridView1.Columns[2].Visible = false;
//GridView1.Columns.RemoveAt(2);
}
else
{
TextBox3.Enabled = true;
GridView1.Visible = true;
this.GridView1.Columns[2].Visible = true;
}
}
When your Columns are autogeneratet (Default=true) then you change the visibility by creating the CELL.. if all cells are invisible, the column will hides automaticly
protected void gridview1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//ShowColumn Check
if (CheckBox2.Checked)
{
e.Row.Cells[2].Visible = false;
}
else
{
e.Row.Cells[2].Visible = true;
}
}
}
for show only selected rows:
1.) Add a new templateColumn (at first position):
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox runat="server"/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
2.) Add a new Button
<asp:Button runat="server" ID="FilterSelected" OnClick="FilterSelected_Click"/>
3.) Add a new ClickEvent
Code:
protected void FilterSelected_Click(object sender, EventArgs e)
{
foreach (GridViewRow rowItem in gridview1.Rows )
{
var myCheckbox = rowItem.Cells[0].Controls[1] as CheckBox; // ONLY if your Checkbox in the FIRST column!!!!
if (myCheckbox != null && !myCheckbox.Checked)
{
rowItem.Visible = false;
}
}
}
}

Not able to access radio button inside datalist in code behind

I am having radio button inside datalist. And I need to access them in code behind. But all my efforts are not working. This is what I am doing :
<asp:DataList ID="dlPaper" runat="server" RepeatColumns="1" RepeatDirection="Vertical"
Width="755px" onitemcommand="item_command">
<ItemTemplate>
<table>
<tr>
<td>
Question :
</td>
<td colspan ="4">
<asp:Label ID="lblQuestion" runat="server" Text='<%#Eval("Question") %>'></asp:Label>?
<asp:Label ID="lblQID" runat="server" Text='<%#Eval("QID") %>' Visible="False"></asp:Label>
</td>
</tr>
<tr>
<td></td>
<td>
A
</td>
<td>
<asp:Label ID="lblOption1" runat="server" Text='<%#Eval("Option1") %>'></asp:Label>
</td>
<td>
B
</td>
<td>
<asp:Label ID="lblOption2" runat="server" Text='<%#Eval("Option2") %>'></asp:Label>
</td>
</tr>
<tr> <td></td>
<td>
C
</td>
<td>
<asp:Label ID="lblOption3" runat="server" Text='<%#Eval("Option3") %>'></asp:Label>
</td>
<td>
D
</td>
<td>
<asp:Label ID="lblOption4" runat="server" Text='<%#Eval("Option4") %>'></asp:Label>
</td>
</tr>
</table>
<table>
<tr>
<td>
Answer :
</td>
<td>
<asp:RadioButton ID="rdOption1" runat="server" Text="A" GroupName="Ans"/>
</td>
<td>
<asp:RadioButton ID="rdOption2" runat="server" Text="B" GroupName="Ans" />
</td>
<td>
<asp:RadioButton ID="rdOption3" runat="server" Text="C" GroupName="Ans" />
</td>
<td>
<asp:RadioButton ID="rdOption4" runat="server" Text="D" GroupName="Ans" />
</td>
<td>
<asp:Button ID="tbnAnswer" runat="server" Text="Submit Answer" CommandName='<%#Eval("QID") %>' OnCommand='item_command'/>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
Code behind it is as :
protected void item_command(object source, CommandEventArgs e)
{
try
{
_ds = new DataSet();
int p = WebHelper.Cast(e.CommandName, 0);
ViewState["QID"] = p;
AnswersBAL abl = new AnswersBAL(SessionContext.SystemUser);
abl.LoadByQID(_ds, p);
if (_ds != null && _ds.Tables[abl.SqlEntityX].Rows.Count > 0)
{
int AID = System.Convert.ToInt32(_ds.Tables[0].Rows[0]["AID"]);
abl.LoadByPrimaryKey(_ds, AID);
screenscrap(_ds.Tables[abl.SqlEntityX].Rows[0]);
abl.Save(_ds);
}
else
{
abl.LoadByPrimaryKey(_ds, int.MinValue);
DataRow dr = _ds.Tables[abl.SqlEntityX].NewRow();
_ds.Tables[abl.SqlEntityX].Rows.Add(dr);
dr["QID"] = System.Convert.ToInt32(ViewState["QID"]);
dr["StdID"] = 1;
//sessioncontext.systemuser
//dr["Option1"]= //
abl.Save(_ds);
}
}
catch (Exception err)
{ }
}
But I am not able to access radio buttons in code behind.
try like this
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "YourCommandName")
{
r1 = (RadioButton)e.Item.FindControl("rdButton");
}
}

how to pop up two modalpopup in gridview

I want to pop up two modalpopup from a gridview. I searched online but couldn't find the exact answer. Any help is appreciated.
--------ModalPopupExtender1---------
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
BackgroundCssClass="ModalPopupBG" CancelControlID="btn_Cancel" Drag="true"
PopupControlID="Panel2" PopupDragHandleControlID="Panel2"
TargetControlID="btnNew">
</asp:ModalPopupExtender>
-----------------PopupControlID="Panel2--------------------------
<div id="Panel2" class="popupConfirmation">
<div class="popup_Container">
<div id="PopupHeader" class="popup_Titlebar">
<div class="TitlebarLeft">
<%--
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
--%>
Edit Customer
</div>
<!--
<div class="TitlebarRight" >
</div>
-->
</div>
<div>
<table bgcolor="#CCFFFF" cellpadding="0" cellspacing="2" width="100%">
<tr>
<td width="5%">
</td>
<td width="25%">
</td>
<td width="65%">
</td>
<td width="5%">
</td>
</tr>
<tr>
<td width="5%">
</td>
<td style="text-align: right" width="25%">
<asp:LabelID="lblName"runat="server"FontSize="11pt" Text="First Name:">
</asp:Label>
</td>
<td style="text-align: left" width="65%">
<asp:TextBox ID="txtFirstName" runat="server" Width="300px">
</asp:TextBox>
<asp:Label ID="lbl_ErrorName" runat="server" ForeColor="Red"
style="display:none" Text="*">
</asp:Label>
</td>
<td width="5%">
</td>
</tr>
<tr>
<td width="5%">
</td>
<td style="text-align: right" width="25%">
<asp:Label ID="lblName2" runat="server" Font-Size="11pt" Text="Second Name:">
</asp:Label>
</td>
<td style="text-align: left" width="65%">
<asp:TextBox ID="txtSecondName" runat="server" Width="300px">
</asp:TextBox>
</td>
<td width="5%">
</td>
</tr>
<%--
<tr>
<td width="5%">
</td>
<td style="text-align: right" width="45%">
<asp:Label ID="lblName0" runat="server" Font-Size="11pt" Text="City">
</asp:Label>
</td>
<td style="text-align: left" width="45%">
<asp:TextBox ID="txtCity" runat="server" Width="200px">
</asp:TextBox>
</td>
<td width="5%">
</td>
<td width="5%">
</td>
</tr>
<tr>
<td width="5%">
</td>
<td style="text-align: right" width="45%">
<asp:Label ID="lblName1" runat="server" Font-Size="11pt" Text="State">
</asp:Label>
</td>
<td style="text-align: left" width="45%">
<asp:TextBox ID="txtState" runat="server" Width="200px">
</asp:TextBox>
</td>
<td width="5%">
</td>
<td width="5%">
</td>
</tr>
--%>
<tr>
<td width="5%">
</td>
<td style="text-align: right" width="25%">
<asp:Label ID="lblAddress1" runat="server" Font-Size="11pt" Text="Address1:">
</asp:Label>
</td>
<td style="text-align: left" width="65%">
<asp:TextBox ID="txtAddress1" runat="server" Width="300px">
</asp:TextBox>
<asp:Label ID="lbl_ErrorAddress1" runat="server" ForeColor="Red"
style="display:none" Text="*">
</asp:Label>
</td>
<td width="5%">
</td>
</tr>
<%--
<tr>
<td width="5%">
</td>
<td style="text-align: right" width="45%">
<asp:Label ID="lblAddress2" runat="server" Font-Size="11pt" Text="Address2:">
</asp:Label>
</td>
<td style="text-align: left" width="45%">
<asp:TextBox ID="txtAddress2" runat="server" Width="200px">
</asp:TextBox>
</td>
<td width="5%">
</td>
<td width="5%">
</td>
</tr>
--%>
<tr>
<td width="5%">
</td>
<td style="text-align: right" width="25%">
<asp:Label ID="lblDOB" runat="server" Font-Size="11pt" Text="Phone">
</asp:Label>
</td>
<td style="text-align: left" width="65%">
<asp:TextBox ID="txtPhone" runat="server" Width="200px">
</asp:TextBox>
<%--
<asp:CalendarExtender ID="txt_DOB_CalendarExtender" runat="server"
TargetControlID="txt_DOB">
</asp:CalendarExtender>
--%>
<asp:Label ID="lblErrorDOB" runat="server" Font-Bold="True" ForeColor="Red"
style="display:none" Text="*">
</asp:Label>
</td>
<td width="5%">
</td>
</tr>
<tr>
<td width="5%">
</td>
<td style="text-align: right" width="25%">
<asp:Label ID="lblDOB0" runat="server" Font-Size="11pt" Text="Mobile">
</asp:Label>
</td>
<td style="text-align: left" width="65%">
<asp:TextBox ID="txtMobile" runat="server" Width="200px">
</asp:TextBox>
</td>
<td width="5%">
</td>
</tr>
<tr>
<td width="5%">
</td>
<td style="text-align: right" width="25%">
</td>
<td style="text-align: left" width="65%">
</td>
<td width="5%">
</td>
</tr>
</table>
</div>
<div align="center">
<asp:Button ID="btn_Update" runat="server"
Text="Save" Width="75px" onclick="btn_Update_Click" />
<asp:Button ID="btn_Cancel" runat="server" Text="Cancel" Width="75px" />
</div>
</div>
</div>
----------------`ModalpopUp`----------------------------
<asp:ModalPopupExtender ID="ModalPopUp" runat="server"
CancelControlID="idclose" Drag="true" DynamicServicePath="" Enabled="True"
PopupControlID="PartyCustomers_idbody"
PopupDragHandleControlID="PartyCustomers_IdTitle"
TargetControlID="btnShowPopup">
<Animations>
<OnShown><Fadein Duration="0.50" /></OnShown>
<OnHiding><Fadeout Duration="0.75" /></OnHiding>
</Animations>
</asp:ModalPopupExtender>
--------------------PartyCustomers_idbody : popupbody--------------
`<div id="PartyCustomers_idbody" runat="server" class="Common_divbody"
>
<div id="PartyCustomers_IdTitle" runat="server" class="Common_divtitle"
>
<div id="idclose" class="Common_close">
</div>
<div class="Common_divhr">
Booked Status</div>
</div>
<div class="ModalPopUpDiv">
<asp:Label ID="lblmessage1" runat="server" Text="Label"></asp:Label>
<asp:GridView ID="dgvSystemDetails" runat="server" AllowPaging="True"
AllowSorting="True" AlternatingRowStyle-CssClass="alt"
AutoGenerateColumns="False" CellSpacing="2" CssClass="mGrid" Font-Bold="True"
Font-Names="Arial" Font-Size="Small" PageSize="12"
Width="750px" DataKeyNames="SystemCode"
onrowdatabound="dgvSystemDetails_RowDataBound">
<AlternatingRowStyle CssClass="alt" />
<Columns>
<asp:BoundField DataField="RegistrationDate" DataFormatString="{0:d}"
HeaderText="Registration Date">
<HeaderStyle />
<ItemStyle />
</asp:BoundField>
<asp:BoundField DataField="SystemCode" HeaderText="System Code" />
<asp:BoundField DataField="Reg_Status" HeaderText="Reg. Status" />
<asp:BoundField DataField="Key" HeaderText="Key" />
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="btnBlock" runat="server" CssClass="Common_button"
Text="Block" onclick="btnBlock_Click" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>`
--------------------------------cs-: RowCommand---code--------------------------
protected void dgvActivatedCustomers_RowCommand1(object sender, GridViewCommandEventArgs e)
{
//Load System details gridview in modalpop up...
if(e.CommandName=="Select")
{
DataSet ds;
int RowIndex = Convert.ToInt32(e.CommandArgument);
long ProductSerialID = Convert.ToInt32(dgvActivatedCustomers.DataKeys[RowIndex].Values["ProductSerialID"]) ;
hdnProuductId.Value= dgvActivatedCustomers.DataKeys[RowIndex].Values["ProductSerialID"].ToString();
lblmessage1.Visible = true;
//string RegStatus = dgvSystemDetails.SelectedRow.Cells[2].Text;
string ProductSerial = dgvActivatedCustomers.Rows[RowIndex].Cells[6].Text;
string Reg_Status = LoadSystemDetails(ProductSerialID).Tables[0].Rows[0]["Reg_Status"].ToString();
lblmessage1.Text = "Activation Code :" + General.GetActivationCode(Convert.ToDouble(ProductSerial)).ToString();
LoadSystemDetails(ProductSerialID);
ds = LoadSystemDetails(ProductSerialID);
//filling data table
DataTable dt = (DataTable)dgvSystemDetails.DataSource;
//Add new columns to datatable
dt.Columns.Add("Key", typeof(System.Int64));
// get key for specific key by passing system code ot getRegistrationKey.
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
string SystemCode = ds.Tables[0].Rows[i]["SystemCode"].ToString();
//lblmessage2.Text = "Key :" + Registration.getRegistrationKey(SystemCode, ProductSerial);
string Key = Registration.getRegistrationKey(SystemCode, ProductSerial);
dt.Rows[i]["Key"] = Key;
}
Session["dgvSystemDetailsDataSource"] = dt;
dgvSystemDetails.DataSource = dt;
dgvSystemDetails.DataBind();
dgvSystemDetails.Visible = true;
if (Reg_Status == "Blocked")
{
lblmessage1.Visible = true;
lblmessage1.Text = "Blocked System";
//dgvSystemDetails.FindControl("btnBlock").Visible = false;
dgvSystemDetails.DataSource = Session["dgvSystemDetailsDataSource"];
dgvSystemDetails.DataBind();
ModalPopUp.Show();
}
ModalPopUp.Show();
}
}
description :btnclick second popup--------------
protected void Button1_Click(object sender, EventArgs e)
{
try
{
Button btn = (Button)sender;
GridViewRow row = (GridViewRow)btn.NamingContainer;
int rowno = row.RowIndex;
txtFirstName.Text = dgvActivatedCustomers.DataKeys[rowno].Values["CustomerName"].ToString();
txtSecondName.Text = dgvActivatedCustomers.DataKeys[rowno].Values["CustomerLName"].ToString();
txtAddress1.Text = (dgvActivatedCustomers.Rows[rowno].Cells[4].Text != " " ? dgvActivatedCustomers.Rows[rowno].Cells[4].Text : "");
txtPhone.Text = (dgvActivatedCustomers.Rows[rowno].Cells[2].Text != " " ? dgvActivatedCustomers.Rows[rowno].Cells[2].Text : "");
txtMobile.Text = (dgvActivatedCustomers.Rows[rowno].Cells[3].Text != " " ? dgvActivatedCustomers.Rows[rowno].Cells[3].Text : "");
hdnId.Value = dgvActivatedCustomers.DataKeys[rowno].Values["CustomerID"].ToString();
txtName.Text = (dgvDemoCust.SelectedRow != "") ? dgvDemoCust.SelectedRow.Cells[0].Text : "";
ModalPopupExtender1.Show();
}
catch (Exception ex) { }
}
Question : The first pop up is showing but the second one doesn't.....any body have any idea

asp.net form submition into oracle database

I am beginer in asp.net. I have created a form. When i submit that form i need to insert the form field values into a table in oracle database schema. I am using Visual Studio 2012 Express. I have already added my database schema to database explorer. Now I need a code to get data from form and insert into table.
Default.aspx code:
<%# Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="Demo._Default" %>
<asp:Content runat="server" ID="FeaturedContent" ContentPlaceHolderID="FeaturedContent">
</asp:Content>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<table align="center" class="auto-style1">
<tr>
<td class="auto-style2">Activity Type</td>
<td>
<asp:DropDownList ID="ActivityTypeDropDown" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ActivityTypeDropDown_SelectedIndexChanged" >
<asp:ListItem Text="--Select" Value="" />
<asp:ListItem>Ticket</asp:ListItem>
<asp:ListItem>Non-Ticket</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="ActivityTypeDropDown" ErrorMessage="Please select Activity Type">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="TktnoLable" runat="server" Text="Ticket NO"></asp:Label>
</td>
<td>
<asp:TextBox ID="TicketNoTextBox" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="TicketNoTextBox" ErrorMessage="Please enter the ticket number">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style2">Ticket Category</td>
<td>
<asp:DropDownList ID="TicketCategoryTextBox" runat="server">
<asp:ListItem>--Select--</asp:ListItem>
<asp:ListItem>Adhoc</asp:ListItem>
<asp:ListItem>Batch Run</asp:ListItem>
<asp:ListItem>Bug Fix</asp:ListItem>
<asp:ListItem>CR</asp:ListItem>
<asp:ListItem>Enhancement</asp:ListItem>
<asp:ListItem>Issue</asp:ListItem>
<asp:ListItem>Others</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="auto-style2">Ticket Description</td>
<td>
<asp:TextBox ID="TicketDescriptionTextBox" TextMode="MultiLine" runat="server" Width="200px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ControlToValidate="TicketDescriptionTextBox" ErrorMessage="Please provide ticket description">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style7">Activity Description</td>
<td class="auto-style8">
<asp:TextBox ID="activityDescriptionTextBox" TextMode="MultiLine" runat="server" Width="200px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ControlToValidate="activityDescriptionTextBox" ErrorMessage="Please provide activity description">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style2">Module</td>
<td>
<asp:TextBox ID="ModuleTextBox" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style3">Priority</td>
<td class="auto-style4">
<asp:DropDownList ID="PriorityDropDown" runat="server">
<asp:ListItem Text="--Select--" Value="" />
<asp:ListItem>High</asp:ListItem>
<asp:ListItem>Medium</asp:ListItem>
<asp:ListItem>Low</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="PriorityDropDown" ErrorMessage="Please select priority">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style2">Resource</td>
<td>
<asp:DropDownList ID="ResourceDropDown" runat="server">
<asp:ListItem text="--Select--" Value="" />
<asp:ListItem>Apporva</asp:ListItem>
<asp:ListItem>Arun</asp:ListItem>
<asp:ListItem>Harshal</asp:ListItem>
<asp:ListItem>Kiran</asp:ListItem>
<asp:ListItem>Nitin</asp:ListItem>
<asp:ListItem>Vagmita</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="ResourceDropDown" ErrorMessage="Please Select a resource">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style2">Creation Date</td>
<td>
<asp:TextBox ID="CreationDateTextBox" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="CreationDateTextBox" ErrorMessage="Please provide creation date">*</asp:RequiredFieldValidator>
<asp:CompareValidator ID="creationdatevalidator" runat="server" ControlToValidate="CreationDateTextBox" ErrorMessage="Please enter valid creation date" Operator="DataTypeCheck" Type="Date">*</asp:CompareValidator>
</td>
</tr>
<tr>
<td class="auto-style2">Assignment Date</td>
<td>
<asp:TextBox ID="AssignmentDateTextBox" runat="server"></asp:TextBox>
<asp:CompareValidator ID="assignmentdatevalidator" runat="server" ControlToValidate="AssignmentDateTextBox" ErrorMessage="please enter valid assignment date" Operator="DataTypeCheck" Type="Date">*</asp:CompareValidator>
</td>
</tr>
<tr>
<td class="auto-style3">Status</td>
<td class="auto-style4">
<asp:DropDownList ID="StatusDropDown" runat="server" AutoPostBack="True" OnSelectedIndexChanged="StatusDropDown_SelectedIndexChanged">
<asp:ListItem Text="--select--" Value="" />
<asp:ListItem>WIP</asp:ListItem>
<asp:ListItem>Completed</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="StatusDropDown" ErrorMessage="Please select status">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="CompletionDateLable" runat="server" Text="Completion Date"></asp:Label>
</td>
<td>
<asp:TextBox ID="CompletionDateTextBox" runat="server"></asp:TextBox>
<asp:CompareValidator ID="completiondatevalidator" runat="server" ErrorMessage="Please enter valid completion date" Operator="DataTypeCheck" Type="Date" ControlToValidate="CompletionDateTextBox">*</asp:CompareValidator>
</td>
</tr>
<tr>
<td class="auto-style5">Remarks</td>
<td class="auto-style6">
<asp:TextBox ID="RemarksTextBox" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">Efforts</td>
<td>
<asp:TextBox ID="EffortsTextBox" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" />
<br />
<br />
<input id="SubmitButton" type="submit" value="Submit" /><asp:Button ID="ResetButton" runat="server" OnClick="ResetButton_Click" Text="Reset" />
<asp:Label ID="Label1" runat="server"></asp:Label>
</td>
</tr>
</table>
</asp:Content>
<asp:Content ID="Content1" runat="server" contentplaceholderid="HeadContent">
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style2 {
width: 119px;
}
.auto-style3 {
width: 119px;
height: 31px;
}
.auto-style4 {
height: 31px;
}
.auto-style5 {
width: 119px;
height: 28px;
}
.auto-style6 {
height: 28px;
}
.auto-style7 {
width: 119px;
height: 47px;
}
.auto-style8 {
height: 47px;
}
</style>
</asp:Content>
Default.aspx.cs code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Oracle.DataAccess;
using Oracle.DataAccess.Client;
namespace Demo
{
public partial class _Default : Page
{
protected void Page_Load(object sender, EventArgs e)
{
var Activity_type = "";
var Ticket_no = "";
var tkt_category = "";
var tkt_desc = "";
var Act_desc = "";
var module = "";
var priority = "";
var resource = "";
var creation_date = "";
var Assigned_date = "";
var status = "";
var completed_date = "";
var remarks = "";
var Efforts = "";
if (IsPostBack)
{
Activity_type = Request.Form["ActivityTypeDropDown"];
Ticket_no = Request.Form["TicketNoTextBox"];
tkt_category = Request.Form["TicketCategoryTextBox"];
tkt_desc = Request.Form["TicketDescriptionTextBox"];
Act_desc = Request.Form["activityDescriptionTextBox"];
module = Request.Form["ModuleTextBox"];
priority = Request.Form["PriorityDropDown"];
resource = Request.Form["ResourceDropDown"];
resource = Request.Form["ResourceDropDown"];
creation_date = Request.Form["CreationDateTextBox"];
Assigned_date = Request.Form["AssignmentDateTextBox"];
status = Request.Form["StatusDropDown"];
completed_date = Request.Form["CompletionDateTextBox"];
remarks = Request.Form["RemarksTextBox"];
Efforts = Request.Form["EffortsTextBox"];
}
}
protected void ActivityTypeDropDown_SelectedIndexChanged(object sender, EventArgs e)
{
if (ActivityTypeDropDown.SelectedValue == "Ticket")
{
TktnoLable.Visible = true;
TicketNoTextBox.Visible = true;
}
else
{
TktnoLable.Visible = false;
TicketNoTextBox.Visible = false;
}
}
protected void ResetButton_Click(object sender, EventArgs e)
{
ClearInputs(Page.Controls);
}
void ClearInputs(ControlCollection ctrls)
{
foreach (Control ctrl in ctrls)
{
if (ctrl is TextBox)
((TextBox)ctrl).Text = string.Empty;
ClearInputs(ctrl.Controls);
}
}
protected void StatusDropDown_SelectedIndexChanged(object sender, EventArgs e)
{
if (StatusDropDown.SelectedValue == "Completed")
{
CompletionDateLable.Visible = true;
CompletionDateTextBox.Visible = true;
}
else
{
CompletionDateLable.Visible = false;
CompletionDateTextBox.Visible = false;
}
}
}
}
Please help me to complete the form action.
Here is simple method to insert data, you can modify it to your needs
public void InsertToOracle(string value)
{
string oradb = "Data Source=ORCL;User Id=user;Password=password;";
using (OracleConnection conn = new OracleConnection(oradb))
{
conn.Open();
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
cmd.CommandText = "Insert into Table1(ColumnName) VALUES(#ParameterName)";
cmd.Parameters.Add(new OracleParameter("#ParameterName", value));
var rowsUpdated = cmd.ExecuteNonQuery();
}
}
In addition in asp.net web forms no needs to use Request.Form
instead of
tkt_category = Request.Form["TicketCategoryTextBox"];
use
tkt_category = TicketCategoryTextBox.Text;
instead of
Activity_type = Request.Form["ActivityTypeDropDown"];
use
Activity_type = ActivityTypeDropDown.SelectedValue;
All items marked with runat=server are ready to use as a object variable

Categories

Resources