0% found this document useful (0 votes)
66 views5 pages

Grid Radio Button Functionality

The document contains code for handling various button click and grid view events related to managing an ongoing development program table. It includes logic for inserting, updating, deleting records as well as clearing fields, selecting rows, and changing button text. Variables are used to track the selected index and a flag for tracking the current operation status. Validation is also performed to check for existing records when trying to insert or update.

Uploaded by

Vijay Bhalerao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views5 pages

Grid Radio Button Functionality

The document contains code for handling various button click and grid view events related to managing an ongoing development program table. It includes logic for inserting, updating, deleting records as well as clearing fields, selecting rows, and changing button text. Variables are used to track the selected index and a flag for tracking the current operation status. Validation is also performed to check for existing records when trying to insert or update.

Uploaded by

Vijay Bhalerao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

public string flag = "";

public int intSelectedIndex;

btnInsertUpdate_Click1

if (btnInsertUpdate.Text == "Save")
{
if (Count > 0)
{
lblErrMessage.Text = objStaticMessageClass.recordExist;
lblErrMessage.Visible = true;
btnInsertUpdate.Text = "Save";
flag = "NotInserted";
MdlPopSaveUpdate.Show();
}
else
{
objF1_1_BAL.Insert(tbl1);
bindGrid(Convert.ToInt32(Master.SelectedValueWatershed));
int lastRowIndex = 0;
foreach (GridViewRow grv in grdOngoingDevelopment.Rows)
{
if (grv.RowType == DataControlRowType.DataRow)
{
if (grv.RowIndex > lastRowIndex)
{
//getting the last data row index
lastRowIndex = grv.RowIndex;
}
}
}
grdOngoingDevelopment.SelectedIndex = lastRowIndex;
lblMessage.Text = objStaticMessageClass.saveMSG;
flag = "Inserted";
//MdlPopSaveUpdate.Show();
}
else if (btnInsertUpdate.Text == "Update")
{
if (Count > 0)
{
lblErrMessage.Text = objStaticMessageClass.recordExist;
lblErrMessage.Visible = true;
btnInsertUpdate.Text = "Update";
flag = "NotUpdated";
MdlPopSaveUpdate.Show();
}
else
{
objF1_1_BAL.Update(tbl1);
bindGrid(Convert.ToInt32(Master.SelectedValueWatershed));
grdOngoingDevelopment.SelectedIndex = -1;
grdOngoingDevelopment.SetRowValueValueByKey(tbl1.ID.ToString());
SetSelectRowImage(grdOngoingDevelopment.SelectedRow, true);
flag = "Updated";
lblMessage.Text = objStaticMessageClass.updateMSG;
}

btnClose_Click

try
{
clearFields();
//grdOngoingDevelopment.SelectedIndex = -1;
btnInsertUpdate.Text = "Save";
}

clearFields()

try
{
//grdOngoingDevelopment.SelectedIndex = -1;
txtProgramName.Text = "";
txtImplementAgency.Text = "";
txtProgramObjective.Text = "";
ddlCommencementYear.SelectedIndex = 0;
txtVillagesCovered.Text = "";
txtProjectCost.Text = "";
lblMessage.Text = "";
}
btnClear_Click

try {
clearFields();
MdlPopSaveUpdate.Show();
flag = "Clear";
}

btnEdit_Click

if (grdOngoingDevelopment.Rows.Count > 0)
{}
else
{ lblMessage.Text = objStaticMessageClass.recordNotExists2;
}

btnAdd_Click

if (Convert.ToInt32(Master.SelectedValueWatershed) != 0)
{
clearFields();
grdOngoingDevelopment.SelectedIndex = -1;
btnInsertUpdate.Text = "Save";
MdlPopSaveUpdate.Show();
}

btnDelete_Click

try
{
if (grdOngoingDevelopment.Rows.Count > 0)
{
if (grdOngoingDevelopment.SelectedIndex != -1)
{
flag = "Delete";
MdlPopDelete.Show();
}
else
{
lblMessage.Text = objStaticMessageClass.selectRow;
}
}
else
{
lblMessage.Text = objStaticMessageClass.recordNotExists2;
}
}

protected void btnCancel_Click(object sender, EventArgs e)


{
try
{
MdlPopDelete.Hide();
flag = "Cancel";
}
catch (Exception ex)
{
lblMessage.Text = ex.Message;
string ErrorLog = "";
ErrorLog = "EXCEPTION SOURCE: DPRKarnataka >> " + ex.GetType().ToString() +
"\nERROR MESSAGE: " + ex.Message + "\nSTACK STRESS: " + ex.StackTrace;
UsersPageCommonData.LogError("F1_1_OngoingDevelopmentProgram.aspx",
"btnCancel_Click", ErrorLog, Session[SessionKeys.UserId]);
}
}

protected void grdOngoingDevelopment_SelectedIndexChanged(object sender, EventArgs e)


{
flag = "SelectedIndexChanged";
if (intSelectedIndex != grdOngoingDevelopment.SelectedRow.RowIndex)

SetSelectRowImage(grdOngoingDevelopment.SelectedRow, true);
else
grdOngoingDevelopment.SelectedIndex = -1;
}

protected void grdOngoingDevelopment_RowCommand(object sender,


GridViewCommandEventArgs e)
{
if (e.CommandName == "ibtnRadio")
{
flag = "RowCommand";
int rowIndex = int.Parse(e.CommandArgument.ToString());
GridViewRow gvr = grdOngoingDevelopment.Rows[rowIndex];

ImageButton ib = gvr.Cells[0].Controls[0] as ImageButton;


string idValue = gvr.Cells[1].ToString();
if (ib != null)
{
ib.ImageUrl = "~/use_images/radiobutton_checked.png";
}
}
}

protected void grdOngoingDevelopment_SelectedIndexChanging(object sender,


GridViewSelectEventArgs e)
{
flag = "RowCommand";
SetSelectRowImage(grdOngoingDevelopment.SelectedRow, false);
intSelectedIndex = grdOngoingDevelopment.SelectedIndex;
}

private void SetSelectRowImage(GridViewRow row, bool bSelect)


{
if (row != null)
{
ImageButton ib = row.Cells[0].FindControl("imgSelect") as
ImageButton;
if (bSelect)
{
ib.ImageUrl = "~/use_images/checked.png";
}
else
{
ib.ImageUrl = "~/use_images/unchecked.png";
}
}
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy