popup window code - asp.net

i have 2 aspax page.
client.aspx
popup.aspx
client.aspx contains a simple registration form. in this form i have to take one of the textbox value from popup.aspx. that textbox contains with a search button
when i click on search button popup.aspx page is opened in a popup window.
in popup.aspx i m showing a grid contains productCode and product name and a select button.
when i select a row of grid then corresponding product name should be displyed in textbox. and tht popup window should be closed.
Update
ImageButton imgbut = sender as ImageButton;
GridViewRow gvr = (GridViewRow)imgbut.NamingContainer;
lblKeyIndex.Text = grd_ProductMaster.DataKeys[gvr.RowIndex].Value.ToString();
lblProductName.Text = gvr.Cells[2].Text;
Session["ProdName"] = lblProductName.Text;
Server.Transfer("client_Master.aspx");
Response.Write("<Script>window.close()</Script>"); Response.Redirect("client_Master.aspx?ProdName=" + lblProductName.Text+"&ProdCode="+lblKeyIndex.Text)
on page load of client.aspx
if (Session["ProdName"] != null)
{
txtSelectProdName.Text = Session["ProdName"].ToString();
}

Open a pop-up window
In your pop-up window try to return the value to parent window.

Related

Disable the "Add New" button in Rad Grid

So I have Rad Grid that contains data and I have in above the Add New Button. I want when user has permission to add to make it enable if he doses not have then its disable I search for hours for a solution and all I come is this code:
Dim cmditem As GridCommandItem = CType(gvDefCountry.MasterTableView.GetItems(GridItemType.CommandItem)(0), GridCommandItem)
Dim ctrl As System.Web.UI.WebControls.Button = CType(cmditem.FindControl("AddNewRecordButton"), System.Web.UI.WebControls.Button)
ctrl.Enabled = False
But every time I run the code, I'm getting this error:
"Index was outside the bounds of the array"
The view looks like:
It should work. Where do you put the codes? if you put it in gvDefCountry_PreRender event of the grid, it will work just fine.
However, i would recommend you to hide the button altogether instead of disabling it, since there will be no visual difference between enabled and disabled state of the button, depending on the skin you use (In my case - Metro). Otherwise, you also need to change the styles to grey it out and remove the mouse hover effect.
try this
If (TypeOf e.Item Is GridEditableItem) AndAlso (e.Item.IsInEditMode) Then
For Each cmdItm As GridCommandItem In RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)
Dim Addbtn As LinkButton = CType(cmdItm.FindControl("InitInsertButton"), LinkButton)
Addbtn.Enabled = False
Dim btn As Button = CType(cmdItm.FindControl("AddNewRecordButton"), Button)
btn.Enabled = False
Next
End If

I have a table with records. No matter which View button I click, the bottom record is displayed

I have a table with a list of records. Each record has a View button. But no matter which View button I click, the bottom record (Acme6) gets opened?
enter image description here
It looks like you are sharing datasource for your list and details pages. If my assumption is correct, then you need to modify your view button event handler as follow:
// onClick event handler for View button
var rowItem = widget.datasource.item;
var listDatasource = widget.parent.parent.datasource;
listDatasource.selectKey(rowItem._key);
app.showPage(app.pages.DetailsPage);

Button as spinner in android

I have two buttons YES and NO.
If user click on the yes Button the Dropdown menu like Spinner should appear
which contains other parameters related to Yes.
user will select one Parameter from that menu(dropdown menu)
I used this line for spinner button
android:background="#android:drawable/btn_dropdown"
OnClick method for Button:
ArrayList<String> spinnerArray = new ArrayList<String>();
spinnerArray.add("one");
spinnerArray.add("two");
spinnerArray.add("three");
spinnerArray.add("four");
spinnerArray.add("five");
ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_dropdown_item, spinnerArray);
spinner.setAdapter(spinnerArrayAdapter);
spinner.setOnItemSelectedListener(this);
with this code my button is look like spinner but on Click dropdown menu not appearing.
How to do this.?????
set your spinner launch mode to dialog android:spinnerMode=dialog this will display a dialog on click and let the user choose a option.

My button click is working only the first time

I have a classic ASP NET page on my SharePoint site with several buttons in it:
Button importZIPPOTBtn = new Button();
importZIPPOTBtn.Click += new EventHandler(importZIPPOTBtn_Click);
this.Controls.Add(new LiteralControl("<br/><br/>"));
this.Controls.Add(importZIPPOTBtn);
The first click on any button is perfectly firing the event, but any further click on any button doesn't fire, I can't understand why...
Consider aadding button to form1 or container element like panel inside page.
Button importZIPPOTBtn = new Button();
importZIPPOTBtn.Click += new EventHandler(importZIPPOTBtn_Click);
this.form1.Controls.Add(new LiteralControl("<br/><br/>"));
this.form1.Controls.Add(importZIPPOTBtn);
You can verfiy in html source, unless you add this way even literal control containing lines breaks will not be rendered.

Details View in Asp.net, Set it to NEW

I have a grid view on my page, and a hidden details view.
When the user wants to add a new entry, they will click a button, and the gridview will become hidden and the details view will become visible. The only problem is I want my details view to automatically be set empty in the NEW mode, without them having to click the new in the details view form.
In the RowCommand event of the gridview:
myDetailsView.Visible = true;
myDetailsView.CurrentMode = DetailsViewMode.Insert;
myGridView.Visible = false;
On button click change the mode like:
DetailsView1.ChangeMode(DetailsViewMode.Insert)

Resources