Showing posts with label gridview. Show all posts
Showing posts with label gridview. Show all posts

Wednesday, March 28, 2012

How do I invoke a suitable event on the client?

I have two TextBoxes above a GridView. The GridView is wrapped in an UpdatePanel and both TextBoxes trigger an ajax GridView refresh OnTextChanged.

This is my problem. The user may sometimes leave nothing in a TextBox - when that happens I assume they mean zero, so I want to put the value of '0' back into the TextBox (which the user has removed, by deleting the entire content of the TextBox). See the javascript: restoreTextBox() function below. What event is available for me to do this and can I just invoke the event or do I need to inherit something. I have tried beginRequest() or pageLoaded() but nothing happens.

PS: The txtAssetPc_TextChanged() server-side method is working fine to update the GridView. I just want to know how I can use a suitable client event.

aspx Code only below (the server code is missing as it is not relevant to this problem).


<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
<Services>
<asp:ServiceReference Path="~/RedirectService.asmx" />
</Services>
</asp:ScriptManager>
<asp:ValidationSummary ID="vsFunds" runat="server" ValidationGroup="TextPC" DisplayMode="BulletList" ShowSummary="true" /><br />
Equities ≥<asp:TextBox ID="txtEquities" runat="server" Text="0" CssClass="text" MaxLength="3" ToolTip="Enter minimum percentage value of Equities (0 - 100)" OnTextChanged="txtAssetPc_TextChanged" AutoPostBack="true" />% <asp:RangeValidator ID="rvEquities" ControlToValidate="txtEquities" runat="server" ErrorMessage="Valid range for Equities is 0-100" Type="Integer" MinimumValue="0" MaximumValue="100" ValidationGroup="TextPC" /><br />
Fixed Income ≥<asp:TextBox ID="txtFixedIncome" runat="server" Text="0" CssClass="text" MaxLength="3" ToolTip="Enter minimum percentage value of Fixed Income (0 - 100)" OnTextChanged="txtAssetPc_TextChanged" AutoPostBack="true" />% <asp:RangeValidator ID="rvFixedIncome" ControlToValidate="txtFixedIncome" runat="server" ErrorMessage="Valid range for Fixed Income is 0-100" Type="Integer" MinimumValue="0" MaximumValue="100" ValidationGroup="TextPC" />

<asp:UpdatePanel ID="upAssetExposure" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="gvAssetExposure" runat="server" AutoGenerateColumns="False" DataKeyNames="PensionFundID"
AllowSorting="True" AllowPaging="True" PageSize="50"
OnRowDataBound="gvAssetExposure_RowDataBound" OnPageIndexChanging="gvAssetExposure_PageIndexChanging" OnSorting="gvAssetExposure_Sorting" >
<PagerSettings Mode="NumericFirstLast" />
<Columns>
<asp:BoundField HeaderStyle-CssClass="ResultsHeading" ItemStyle-CssClass="tdCol32" NullDisplayText="N/A" DataField="FundName" HeaderText="Investor" SortExpression="FundName" />
<asp:BoundField HeaderStyle-CssClass="ResultsHeading" ItemStyle-CssClass="tdCol12" NullDisplayText="N/A" DataField="TotalFundAssetsSterling" HeaderText="Total Fund Assets (GBP)" SortExpression="TotalFundAssetsSterling" DataFormatString="{0:GBP ###,### m; N/A}" HtmlEncode="False" />
<asp:BoundField HeaderStyle-CssClass="ResultsHeading" ItemStyle-CssClass="tdCol12" NullDisplayText="N/A" DataField="Equities_Percent" HeaderText="Equities (%)" SortExpression="Equities_Percent" DataFormatString="{0:##; N/A}" HtmlEncode="False" />
<asp:BoundField HeaderStyle-CssClass="ResultsHeading" ItemStyle-CssClass="tdCol12" NullDisplayText="N/A" DataField="FixedIncome_Percent" HeaderText="Fixed Income (%)" SortExpression="FixedIncome_Percent" DataFormatString="{0:##; N/A}" HtmlEncode="False" />
</Columns>
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="txtEquities" EventName="TextChanged" />
<asp:AsyncPostBackTrigger ControlID="txtFixedIncome" EventName="TextChanged" />
</Triggers>
</asp:UpdatePanel>

<script type="text/javascript">
var aTxt = ['<%txtEquities.ClientID%>','<%txtFixedIncome.ClientID%>'];
function restoreTextBox(){
for (var e=0; e < aTxt.length; e++){
var txtBox = document.getElementById(aTxt[e]);
if (txtBox.value == '')
txtBox.value = '0';
}
}
</script>

Just add onblur="restoreTextBox();" to your textboxes.

Monday, March 26, 2012

How do I get the CalendarExtender to show Gridview Templete Field

Hi

i want to use Calendar Extender Control in My grid view's temple field how can i use that calendar control

Code (calendar extender is associated with End Date):

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="Employee Id,Start Date" DataSourceID="SqlDataSource1">
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="Employee Id" HeaderText="Employee Id" ReadOnly="True" SortExpression="Employee Id" />
<asp:TemplateField HeaderText="Start Date" SortExpression="Start Date">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("[Start Date]") %>'></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("[Start Date]") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="End Date" SortExpression="End Date">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("[End Date]") %>'></asp:TextBox>
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="Textbox1">
</cc1:CalendarExtender>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("[End Date]") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>

How do I exit GridViews EditMode when user clicks to another TabPanel?

I've got a GridView/FormView pair on each of four TabPanels. If a user has a GridView is in EditMode in one tab and he clicks on another tab's header, I want to have the GridView on the current panel exit EditMode.

I've tried several approaches, but with no results, save one. That setup, though the GridView did exit EditMode, theentire TabContainer refreshed - took forever, and really looks crappy.

In the one that "worked", I had this in my code behind:

Protected Sub tabContEquipment_ActiveTabChanged(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles tabContEquipment.ActiveTabChangedGridView1.EditIndex = -1GridView2.EditIndex = -1GridView3.EditIndex = -1GridView4.EditIndex = -1End Sub

And in the TabContainer's tag, I had to include this:

<ajaxToolkit:TabContainer ID="tabContEquipment" runat="Server" CssClass="active_tab inactive_tab hover_tab" ActiveTabIndex="0" OnActiveTabChanged="tabContEquipment_ActiveTabChanged" AutoPostBack="true">

My latest attempt was to call a sub from each of the tabs' OnClientClick event and exit the EditMode for that tab's GridView. Like such:

<ajaxToolkit:TabPanel ID="tabEquip" runat="server" HeaderText="Equipment" OnClientClick="GridView1_ExitEditMode">

and:

Public Sub GridView1_ExitEditMode(ByRef senderAs Object,ByRef eAs System.EventArgs)GridView1.EditIndex = -1End Sub

That just resulted in the entire TabContainer not rendering and I got the error: 'GridView1_ExitEditMode' is not defined. That's likely due to my inexperience in coding, but I don't understand why that setup didin't work...

I'm wondering if this has something to do with working with triggers and child controls within the container and its panels, but I'm not really getting how those work together either!

I'dREALLY appreciate it if someone could help me out here. I really thought this would be a simple matter of just setting EditMode = -1 for the GridView when the user clicks another header, but obviously that's not the case! (Which seems to be the rule, rather than the exception with the AJAX Control Toolkit - another remark from a very inexperienced developer!)

Thanks!

C'mon! No one's got any suggestions/ideas?

I'dreally appreciate some helpl here!

Thanks.


Hey, guys, I'm still not getting anywhere with this problem.

Could anyone offer any suggestions?

Thank


capella07:

<ajaxToolkit:TabPanel ID="tabEquip" runat="server" HeaderText="Equipment" OnClientClick="GridView1_ExitEditMode">

and:

Public Sub GridView1_ExitEditMode(ByRef senderAs Object,ByRef eAs System.EventArgs)GridView1.EditIndex = -1End Sub

That just resulted in the entire TabContainer not rendering and I got the error: 'GridView1_ExitEditMode' is not defined. That's likely due to my inexperience in coding, but I don't understand why that setup didin't work...

OnClientClick property indicates the client side function that will be called when the panel is clicked on client side, but it doesn't exist in your code.

capella07:

I've tried several approaches, but with no results, save one. That setup, though the GridView did exit EditMode, theentire TabContainer refreshed - took forever, and really looks crappy.

In the one that "worked", I had this in my code behind:

Protected Sub tabContEquipment_ActiveTabChanged(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles tabContEquipment.ActiveTabChangedGridView1.EditIndex = -1GridView2.EditIndex = -1GridView3.EditIndex = -1GridView4.EditIndex = -1End Sub

And in the TabContainer's tag, I had to include this:

<ajaxToolkit:TabContainer ID="tabContEquipment" runat="Server" CssClass="active_tab inactive_tab hover_tab" ActiveTabIndex="0" OnActiveTabChanged="tabContEquipment_ActiveTabChanged" AutoPostBack="true">

This is an easy way to achieve what you described, and I think you may place the TabContainer in a UpdatePanel to avoid a full postback.

How do I Databind to a GridView inside an Accordion Pane

I am trying to DataBind the results of a query to a GridView Control inside an Accoridon Pane. I can get the data from the elements in the Accordion Pane but I don't know how to add or bind data to them. Here is my code

ASP Code

<atlasToolkit:Accordion ID="MyAccordion" runat="server" SelectedIndex="0"
HeaderCssClass="accordionHeader" ContentCssClass="accordionContent"
FadeTransitions="true" FramesPerSecond="40" TransitionDuration="250"
AutoSize="none" >
<atlasToolkit:AccordionPane ID="AccordionRest" runat="server" >
<Header>
<a href="http://links.10026.com/?link=" onclick="return false;" class="accordionLink">Restricted Items</a>
</Header>
<Content><h1>Restrict SKUs</h1>
<asp:Label ID="lRestricted" runat="server" Text="This Months Restricted SKUS"></asp:Label>
<asp:GridView ID="gvRestricted" runat="server"></asp:GridView> <!-- This is the GridView I want to DataBind my DataSet to -->
<asp:Button ID="bRestricted" runat="server" OnClick="bRest_Click1" Text="Button" />
</Content>
</atlasToolkit:AccordionPane>

< /atlasToolkit:Accordion>

C# code

protected void Page_Load(object sender, EventArgs e)
{
String invoice = Session["invoice"].ToString();
DataSet data = ws.fillMain(invoice); //webservice to returns a DataSet
GridView gvRest = (GridView)AccordionRest.ContentContainer.FindControl("gvRest"); //This how I would get GridView, but I doesn't work to add Data to a GridView
gvRest.DataSource = data.Tables[0];
gvRest.DataBind();
}

If anyone has run into this problem and has figured out how to do this please let me know, thank you

I would create and bind the gridview in codebehind...

<atlasToolkit:AccordionID="MyAccordion"runat="server"SelectedIndex="0"

HeaderCssClass="accordionHeader"ContentCssClass="accordionContent"

FadeTransitions="true"FramesPerSecond="40"TransitionDuration="250"AutoSize="None">

</atlasToolkit:Accordion>

code behind:

...

AccordianPane pane =newAccordionPane();

pane.HeaderContainer.Controls.Add(newLiteralControl("headerName"));

pane.ContentContainer.Controls.Add(GetGridView());

MyAccordion.Controls.Add(pane);

privateGridView GetGridView(){

GridView gridView =newGridView();

...

}


Thanks for the help that worked Perfect.

I was able to add and populate the GridView control on the Accordion Pane. But I ran into an new obsticle. I have added a CommandField column to my GridView, and I want to catch the event when my commandview is selected. But I don't know how to declare the OnSelectedIndexChange in the code behind, and i dont' know if I catching the event correctly. Any help would be greatly appreciated, I am fairly new to ASP and Atlas, so detailed explainations and code examples are greatley appreicated.

Here is my code.

protected void Page_Load(object sender, EventArgs e) {try { String invoice = Session["invoice"].ToString(); DataSet data = ws.fillCustomer(invoice); GridView gvRestricted = NewGridView();/*how do I add a Command Field Event so I can catch it*/ gvRestricted.DataSource = data.Tables[0]; gvRestricted.DataBind(); AccordionRest.ContentContainer.Controls.Add(gvRestricted); }catch { } }public GridView NewGridView() { CommandField delete =new CommandField(); delete.ShowDeleteButton =true; delete.DeleteText ="Clear"; GridView grid =new GridView(); grid.CssClass ="gridView"; grid.HeaderStyle.CssClass ="gridViewHeader"; grid.FooterStyle.CssClass ="gridViewFooter"; grid.AlternatingRowStyle.CssClass ="gridViewAlternate"; grid.PagerStyle.CssClass ="gridViewPager"; grid.RowStyle.CssClass ="gridViewRow"; grid.Columns.Add(delete);return grid; }void gvRest_DeleteIndexChanged(Object sender, EventArgs e) { GridView grid = (GridView)AccordionRest.ContentContainer.FindControl("gvRest"); GridViewRow row = grid.SelectedRow;/*This is where I need to hand the event of the command field being triggered*/ }

I found the solution

grid.SelectedIndexChanged += new EventHandler(grid_SelecetedIndexChanged);

void grid_SelectedIndexChanged(Object sender, EventsArgs e)
{

}


I created the grid in code behind and register the PAgeIndexChanging event, but when I click in a diferent Page number the event hadlr is not fired or is filtreded by the accordion control and I don't get to change the page. Besides the site does a Posta back, whichi is not correct, because the accordion is inside a UpdataPanel de Ajax.

I don't know how to solve this issue.

Thank in advance for you help.


Try doing this for each AccordionControl on your page in the Page_Load event (before doing anything else with the AccordionControls):

 
Accordion1.FindControl("dummy");

The "dummy" name isn't important, it's just that calling the FindControl method works around the problem. The full details of the problem were posted athttp://couldbedone.blogspot.com/2007/07/what-wrong-with-accordion-control.html (thanks to Yuriy!)

Saturday, March 24, 2012

How do I access controls in a TabContainer for FormView Select Parameters

I have a page with a gridview which is inside a tab panel.

Depending upon the selection in the GridView I need to set a Select Parameter for a FormView on another area of the page.

I simply get the error "Could not find control 'GridView2' in ControlParameter 'PoemID'"

Any suggestions ?

i got the same problem trying to access a label inside a tabcontainer...

someone pease help us!


I have had some success with resolving a similar problem by adding the name of the container to to the ControlId parameter as follows: ContainerName$Gridview2

I have an UpdatePanel with a textbox inside, further down the page I have a tab panel that needs to reference the value entered into the textbox and was able to get it to work by having the following syntax:<asp:ControlParameterControlID="UpdatePanel1$TextBox1" ...... what I can't work out is how to reference the same textbox from the tabpanel if it was placed within another tabpanel above or a different container such as an accordion panel. let me know if this gives you any clues...


Found any solution yet? I'm also facing the same problem. Thank you for sharing.

Men, thanks to you I could fix my application...

You just have to do the same with all the controls of the panel, but remember to use the tab container and the tab panel, OK... Here my example... Thnaks

--

SelectMethod="GetEmpleado_MByNumero"TypeName="RecursosHumanoBLL"UpdateMethod="UpdateEmpleadosMByNumeroEmpleado"OldValuesParameterFormatString="{0}">

<SelectParameters>

<asp:ControlParameterControlID="udpConsultaEmpleado$tcEmpleados$tpFiltro$gvEmpleados"DefaultValue="1"Name="Numero"

PropertyName="SelectedValue"Type="Int32"/>

</SelectParameters>

--

I hope it work for you too

How Can Show Loading on Page_Load

My Englist is Bad!

Under is the translation:
I thought increase GridView time demonstrates "Loading"
How do I want to do?

hello.

are you talking about doing this with atlas?


yes ,can you help me?

How can I utilize AjaxControlToolkit:CalendarExtender inside my Gridview during edit mode?

Hello guys,

I have a Gridview control that has StartDate, EndDate field columns. In edit mode, when I clicked the StartDate or EndDate textbox to change the date, I need the calendarExtender popup, so I can select any particular date.

I tried this code in my ASPX page code behind, but still didn't work. Here is the code snippet:

...
TextBox txtStartDate = (TextBox)row.FindControl("txtStartDate");
AjaxControlToolkit.CalendarExtender calExtender =new AjaxControlToolkit.CalendarExtender();
calExtender.Format ="MM/d/yyyy";
calExtender.CssClass ="ajax__calendar";
calExtender.TargetControlID ="txtStartDate";
calExtender.DataBind();

TextBox txtEndDate = (TextBox)row.FindControl("txtEndDate");
AjaxControlToolkit.CalendarExtender calExtender2 =new AjaxControlToolkit.CalendarExtender();
calExtender2.Format ="MM/d/yyyy";
calExtender2.CssClass ="ajax__calendar";
calExtender2.TargetControlID ="txtEndDate";
calExtender2.DataBind();
...

Is there any step procedures, source code, or reference example, etc. I can use to accomplish this task? I greatly appreciate for any help to solve this problem. Thanks.

Why not convert your bound column to a item template column and drop the CalendarExtender Control directly inside the GridView?


or just use something similar toGreg Benoit's resusable calendar solution

I use this all over my site and i only have 1 calendar extender in the entire app. You can easily attach the extender on-the-fly using his example


I'll try to implement it on my Gridview control. Thanks for your suggestion.

Wednesday, March 21, 2012

How can I update a detailsview from a gridview in Atlas?

Hi, I have a gridview and a detailsview. The gridview takes a value from a textbox and retrieves rows. It has been atlas enabled and works fine. Now I want to take a value from the gridview and populate the detailsview. I have an asp:commandfield in my gridview for select, but everytime I click it is causes a postback. I don't want a postback (that's the whole reason for atlas). I don't believe I doing this correctly, my design. Also, all my detailsview "stuff" is in an updatepanel for atlas.

Any help is appreciated on how I can populate a detailsview based upon a gridview in atlas. Thanks.

Isn't this a common practice in non-atlas applications? Clicking a row in a gridview and populating a detailsview or formsview?

You need to set the Datakey on the gridview to the ID field of your datatable (hopefully you have one). Then set the datasource on the details view and configure the input parameter to be a control and pickup the Datakey from your gridview. This is a standard master detail setup, you can find good documentation on this in the VS 2005 documentation.(ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_vwdcon/html/e3ab20ae-44c3-43f0-91f3-0f95fff47b48.htm).

I'm guessing the Atlas part of this is the fact your page is doing postbacks. So you need to put an updatepanel around the gridview and another around the detailsview? Then put a trigger on the detailsview updatepanel to point at the griview and the "SelectedIndexChanged" event.

Hope this helps


I am doubtful that the server side UpdatePanel control will provide what you are looking for. However, Atlas provides two client side controls ListView and ItemView which are exactly designed for your scenario.


Xiyuan Shen:

I am doubtful that the server side UpdatePanel control will provide what you are looking for. However, Atlas provides two client side controls ListView and ItemView which are exactly designed for your scenario.

Thank you. I will try it. But this does kind of get rid of my nice drag and drop abilities doesnt it?


you can bind a dragDropList behavior to the ListView and a dataSourceDropTarget to the ItemView to achive the DND

Xiyuan Shen:

you can bind a dragDropList behavior to the ListView and a dataSourceDropTarget to the ItemView to achive the DND

Sorry, I should have been clearer. I was referring to the drag and drop controls of Visual Studio 2005. I paid $800 for it. I don't like not being able to use it like the other controls. Hopefully, there will be a way to add drag and drop Atlas controls in the IDE's toolbox one day.


Checkout Scott Guthrie's video athttp://atlas.asp.net/Default.aspx?tabid=47

It's an excellent tutorial on getting started with Atlas. It combines GridView and Details View, with some filtering. You can also download for offline viewing.


petehbourne:

Checkout Scott Guthrie's video athttp://atlas.asp.net/Default.aspx?tabid=47

It's an excellent tutorial on getting started with Atlas. It combines GridView and Details View, with some filtering. You can also download for offline viewing.

I have watched it, but could not see where he selected a value in the gridview and populated a detailsview. He did it the other way around it looks like.


Hopehttp://forums.asp.net/thread/1247115.aspx can provide you some help

How can I reproduce that behavior (using AJAX PRO) with ATLAS?!?

Hello again ! I have a normal page, with a search button, that open a popup(dhtml-div-iframe) !

Using AJAX PRO:

In that IFRAME(popup) I have a GridView with a LinkButton that calls a JS function passing a selected key!

The JS Function call a server function passing that key!

The server funtion get a class´s object and pass to JS function...

The JS function Fill all fields from my MAIN form and close POPUP !

How can I do that using ATLAS?

[]´s

No help ?!?

:(


Not an expert, but here are a few suggestions:

Take a look at the atlas control toolkit,

For the pop up, there's a pop up extender. To fill the GridView async, you can use a web service. Actually, you don't have to. Just putting the GridView in an UpdatePanel with a PartialRendering ScriptManager will let you re-fill it with any query you'd like.

And by the way, there's also a ModalPopUp extender, might fit your needs better.

how can i make ajax work this way?

on my form, clicking on the navigation items on the left of screen will filter/refresh the gridview on the right hand side,

how can i achieve this using Ajax and not let the navigation items to reload themselves? (only the gridview refreshes)

Just make sure you only wrap the content you want to be dynamic with theUpdatePanel. That should be all you need. Start there and let us know if you're not getting what you want.


Thanks flanakin, in my applicaton, the dropdownlist has already been placed outside of UpdatePanel. the whole page reloads because the dropdownlist is "autopostback".

I found 3 lines of code that helped me to stop the whole page reload:

<Triggers>

<asp:AsyncPostBackTriggerControlID="DropDownList1"EventName="SelectedIndexChanged"/></Triggers>

I put the code inside the code of UpdatePanel, it worked, This can also be achieved by setting "Triggers" property of the UpdatePanel in design view

How can I implement PopupControlExtender with Calendar in EditItemTemplate in GridView?

Hello,

I've to provide the user in my company with an editable gridview. When clicking on "edit" button there should be available a textbox with the ability to enter a date. This datevalue should come from a calendar.

I would like to have the calendar popuped at the bottom of the textbox.

I looked to the SampleWebsite of AtlasControlToolkit and had success to build a new aspx page with a textbox, a calendar and a PopupControlExtender.

For my question I also searched a lot in the internet and in this forum, but I didn't find the solution which works in my WebApplication.

I develop in VB with Visual Studio .NET 2005, SQL 2005 and have the newest Version of Atlas, AtlasControlTookit and AtlasControlExtender installed.

Could anybody help me?

Thanks a lot.

Paul
I'm not sure I understand your question, but generally you just put the Textbox and PopupControlExtender into the EditTemplate, and I think you can put the calendar control outside of the GridView and just reference it.
Hi, thanks for your advise.

Does this work equally well with a calender control in the footer? My code is as follows.

<asp:GridView ID="gvMisc" runat="server" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="odsTrans" EmptyDataText="No data" ShowFooter="True" OnRowCommand="gvMisc_RowCommand" OnRowDataBound="gvMisc_RowDataBound">
<Columns>
<asp:TemplateField HeaderText="From" SortExpression="dtFrom">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("dtFrom") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label33" runat="server" Text='<%# Bind("dtFrom", "{0:dd MMM yyyy}") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtFrom" runat="server" CausesValidation="True" ValidationGroup="Validation_Footer"></asp:TextBox>
<atlas:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<atlasToolkit:PopupControlExtender ID="PopupControlExtenderFromDate" runat="server">
<atlasToolkit:PopupControlProperties TargetControlID="txtFrom" PopupControlID="calFrom" Position="Right" />
</atlasToolkit:PopupControlExtender>
</ContentTemplate>
</atlas:UpdatePanel>
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Calendar ID="calFrom" runat="server" BackColor="White" BorderColor="#999999"
CellPadding="4" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt"
ForeColor="Black" OnSelectionChanged="calFrom_SelectionChanged" Width="160px">
<SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" />
<TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" />
<SelectorStyle BackColor="#CCCCCC" />
<WeekendDayStyle BackColor="#FFFFCC" />
<OtherMonthDayStyle ForeColor="#808080" />
<NextPrevStyle VerticalAlign="Bottom" />
<DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" />
<TitleStyle BackColor="#999999" BorderColor="Black" Font-Bold="True" />
</asp:Calendar>

and on the server

protected void calFrom_SelectionChanged(object sender, EventArgs e)
{
PopupControlExtender pce = (PopupControlExtender)gvMisc.FooterRow.FindControl("PopupControlExtenderFromDate");
pce.Commit(calFrom.SelectedDate.ToString("dd MMM yyyy"));
}

How can i give alert box when one row from gridview is deleted (gridview is inside a updat

How can i give alert box when one row from gridview is deleted (gridview is inside a updatepanel)...... Please help me.....

Hi,

try to:

1. Hook up the RowDeleted event of the GridView.

2. Inject the following JavaScript using the ScriptManager.RegisterStartupScript method:

(function() { var fn = function() { alert('Row Deleted!'); Sys.Application.remove_load(fn); } Sys.Application.add_load(fn); })();

I can't understand that...how i give this? from where i call that function?


Hi,

You need to place a timer in the UpdatePanel, and use it to check if a row has been deleted.

When it's true, use ScriptManager.RegisterStartupScript method to register a client script and show a alert.

Hope this gives you a basic idea.

How Can i get the new values from PopupWindow using Atlas ModalPopupExtender

Hi Friends,

I have completed the part of getting values from gridView and show the values in popupwindow using Atlas ModalPopupExtender.But now my requirement is

i need to edit the values in PopupWindow Textbox.if i edit the values i need to get that new Value.But I cant get it.Pls tell me how can i solve this Problem

Here is my code :

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" EnableEventValidation="false"%>
<%@dotnet.itags.org. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc2" %>
<%@dotnet.itags.org. Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="cc1"%>
<%@dotnet.itags.org. Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link href="http://links.10026.com/?link=format.css" rel="stylesheet" type="text/css" />
<link href="http://links.10026.com/?link=default.css" rel="stylesheet" type="text/css" />
<link href="http://links.10026.com/?link=ModalDialogs.css" rel="Stylesheet" type="text/css" />


<title>Untitled Page</title>
<script type="text/javascript">
var clientid;
function fnSetFocus(txtClientId)
{
clientid=txtClientId;
setTimeout("fnFocus()",1000);

}
function fnFocus()
{
eval("document.getElementById('"+clientid+"').focus()");
}
function fnClickOK(sender, e) {
__doPostBack(sender,e);
}
function PopupOrder()
{
setInterval('Popup()', 0);

}



function Popup(str)
{
flag = document.getElementById('hidOrderFlag');
if (flag)
{
if (flag.value == '1')
{
document.getElementById('btnhiddenemployee').click();
flag.value = '0';
}
}
}
</script>

</head>

<body bgcolor="#ebf7fe" style="text-align: center">
<form id="form1" runat="server">
<div>
<atlas:ScriptManager ID="atl" EnablePartialRendering="true" runat="server">
</atlas:ScriptManager>

<div runat="server" id="testdiv" style="text-align: center">
</div>

<atlas:UpdatePanel ID="upd" runat="server" Mode="Conditional">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Enter Last Name to search" Font-Bold =True ForeColor="MidnightBlue"></asp:Label>
:
<asp:TextBox ID="TextBox1" OnTextChanged = "TextBox1_TextChanged" AutoPostBack =true runat="server" Height="20px"
Width="150px" BorderStyle="Solid" Font-Bold="False"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
ErrorMessage="Enter KeyWord"></asp:RequiredFieldValidator>

<br />
<asp:GridView ID="GridView1" runat="server" GridLines="None" OnPageIndexChanging="GridView1_PageIndexChanging" AllowPaging="True" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333">
<Columns>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:ImageButton ID="btnEdit" ImageUrl="~/images/Calendar.png" CausesValidation="false" runat="server" OnCommand="CommandButton_OnSelect" OnClientClick="javascript:PopupOrder(); return true;"/>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="empID" HeaderText="EmpID" />
<asp:BoundField DataField="firstname" HeaderText="FirstName" />
<asp:BoundField DataField="lastname" HeaderText="LastName" />
<asp:BoundField DataField="social" HeaderText="Social" />
<asp:BoundField DataField="department" HeaderText="Department" />
<asp:BoundField DataField="addres" HeaderText="Address" />
<asp:BoundField DataField="phone" HeaderText="Phone" />
<asp:BoundField DataField="appdate" HeaderText="AppDate" />
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" />
<EditRowStyle BackColor="#2461BF" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />

</asp:GridView>

</ContentTemplate>
</atlas:UpdatePanel>
<!--cheesy button for the modal popups target control-->



<asp:Panel ID="pnlEmployee" runat="server" CssClass="modalBox" Style="display:none" Width="300px">

<asp:Panel ID="EmployeeCaption" runat="server" CssClass="caption" Style="margin-bottom: 10px; cursor: hand;">
Edit Employee</asp:Panel>
<atlas:UpdatePanel ID="UpdatePopup" runat="server" Mode="Always">
<ContentTemplate>

<asp:HiddenField ID="hidEmployeeEditIndex" runat="server" Value="-1" />

<div>First Name</div><div> <asp:TextBox ID="txtFirstName" runat="server" AutoCompleteType="FirstName" MaxLength="64" Width="250"></asp:TextBox></div>

<div>Last Name</div><div><asp:TextBox ID="txtLastName" runat="server" AutoCompleteType="lastname" MaxLength="64" Width="250"></asp:TextBox></div>


<div>Social</div> <div><asp:TextBox ID="txtsocial" runat="server" MaxLength="64" Width="250"></asp:TextBox></div>


<div>Department</div><div><asp:TextBox ID="txtdepartment" runat="server" MaxLength="64" Width="250" AutoCompleteType="Department"></asp:TextBox></div>

<div>Address</div><div><asp:TextBox ID="txtaddress" runat="server" MaxLength="64" Width="250"></asp:TextBox></div>

<div>Phone</div><div><asp:TextBox ID="txtphone" runat="server" MaxLength="64" Width="250"></asp:TextBox></div>

<div>AppDate</div><div><asp:TextBox ID="txtappdate" runat="server" MaxLength="64" Width="250"></asp:TextBox></div>

<div class="clearer">
</div>

<div><asp:Button ID="btnSaveEmployee" runat="server" Text="Save" UseSubmitBehavior="False" CausesValidation="true" OnClick="btnSaveEmployee_Click"/>
<asp:Button ID="btnCancelEmployee" runat="server" CausesValidation="false" Text="Cancel"/></div>
<input id="first" type="hidden" runat="server" />
<input id="last" type="hidden" runat="server" />
<input id="social" type="hidden" runat="server" />
<input id="department" type="hidden" runat="server" />
<input id="address" type="hidden" runat="server" />
<input id="phone" type="hidden" runat="server" />
<input id="applicationDate" type="hidden" runat="server" />
</ContentTemplate>
</atlas:UpdatePanel>
</asp:Panel>

<input type="hidden" runat="server" id="hidOrderFlag" value="1" />
<input type="button" id="btnhiddenemployee" runat="server" style="display:none" onserverclick="btnhiddenemployee_ServerClick1"/>


<cc1:ModalPopupExtender ID="MyExtender" runat="server">
<cc1:ModalPopupProperties TargetControlID="btnhiddenemployee" PopupControlID="pnlEmployee" OkControlID="btnSaveEmployee"/>
</cc1:ModalPopupExtender>


<atlas:AutoCompleteExtender ID="AutoCompleteExtender1" DropDownPanelID="testdiv" runat="server">
<atlas:AutoCompleteProperties Enabled="true"
MinimumPrefixLength="1"
TargetControlID="TextBox1"
ServicePath="~/Services/ProductService.asmx"
ServiceMethod="FindProducts" />
</atlas:AutoCompleteExtender>
</div>
</form

</body>
</html
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlTypes;
using System.Data.SqlClient;
using AjaxControlToolkit.Design;
using AtlasControlToolkit;
using AtlasTextBoxAutoComplete.SQlQuery;

public partial class _Default : BasePage
{

// Db Declaration

SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["EMP"].ConnectionString);
DataSet ds = new DataSet();

protected void Page_Load(object sender, EventArgs e)
{

// btnSaveEmployee.OnClientClick = String.Format("fnClickOK('{0}','{1}')", btnSaveEmployee.UniqueID, "");

GridView1.Attributes.Add("Init", "fnSetFocus('" + txtFirstName.Text + "');");
GridView1.Attributes.Add("Init", "fnSetFocus('" + txtLastName.ClientID + "');");
btnSaveEmployee.OnClientClick = String.Format("fnClickOK('{0}','{1}')", btnSaveEmployee.UniqueID, "");
if (conn.State == ConnectionState.Open) conn.Close();
conn.Open();
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{

if (TextBox1.Text != "")
{
Bind(this.TextBox1.Text);
}
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{

GridView1.PageIndex = e.NewPageIndex;
Bind(this.TextBox1.Text);

}
protected void CommandButton_OnSelect(object sender, EventArgs e)
{


ImageButton btnEdit = sender as ImageButton;
GridViewRow row =(GridViewRow)btnEdit.NamingContainer;

hidEmployeeEditIndex.Value = Scrub(row.Cells[1].Text);
txtFirstName.Text = Scrub(row.Cells[2].Text);
txtLastName.Text = Scrub(row.Cells[3].Text);
txtsocial.Text = Scrub(row.Cells[4].Text);
txtdepartment.Text = Scrub(row.Cells[5].Text);
txtaddress.Text =Scrub(row.Cells[6].Text);
txtphone.Text = Scrub(row.Cells[7].Text);
txtappdate.Text = Scrub(row.Cells[8].Text);


}

public void Bind(string lastname)
{

if (conn.State == ConnectionState.Open) conn.Close();
conn.Open();
SqlCommand cmd = new SqlCommand("SP_GetEmployees", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@dotnet.itags.org.lastname", System.Data.SqlDbType.VarChar, 255));
cmd.Parameters["@dotnet.itags.org.lastname"].Value = lastname;
SqlDataReader reader = cmd.ExecuteReader();

DataTable dt = new DataTable();

DataColumn dc0 = new DataColumn();
dc0.ColumnName = "empID";

DataColumn dc1 = new DataColumn();
dc1.ColumnName = "lastname";

DataColumn dc2 = new DataColumn();
dc2.ColumnName = "firstname";

DataColumn dc3 = new DataColumn();
dc3.ColumnName = "social";

DataColumn dc4 = new DataColumn();
dc4.ColumnName = "department";

DataColumn dc5 = new DataColumn();
dc5.ColumnName = "addres";

DataColumn dc6 = new DataColumn();
dc6.ColumnName = "phone";

DataColumn dc7 = new DataColumn();
dc7.ColumnName = "appdate";

dt.Columns.Add(dc0);
dt.Columns.Add(dc1);
dt.Columns.Add(dc2);
dt.Columns.Add(dc3);
dt.Columns.Add(dc4);
dt.Columns.Add(dc5);
dt.Columns.Add(dc6);
dt.Columns.Add(dc7);

ds.Tables.Add(dt);

while (reader.Read())
{


DataRow dr = dt.NewRow();
dr["empID"] = reader.GetValue(0).ToString();
dr["lastname"] = reader.GetValue(1).ToString();
dr["firstname"] = reader.GetValue(2).ToString();
dr["social"] = reader.GetValue(3).ToString();
dr["department"] = reader.GetValue(4).ToString();
dr["addres"] = reader.GetValue(5).ToString();
dr["phone"] = reader.GetValue(6).ToString();
dr["appdate"] = reader.GetValue(7).ToString();

dt.Rows.Add(dr);
}
reader.Close();
GridView1.DataSource = ds;
GridView1.DataBind();
}

protected void btnhiddenemployee_ServerClick1(object sender, EventArgs e)
{
hidOrderFlag.Value = "1";
}
//protected void btnSaveEmployee_OnClick(object sender, EventArgs e)
//{
// SqlCommand cmd = new SqlCommand("update tblemployee set firstname= '" + txtFirstName.Text + "',lastname='" + txtLastName.Text + "',social='" + txtsocial.Text + "',department='" + txtdepartment.Text + "',addres='" + txtaddress.Text + "',appdate='" + txtappdate.Text + "' where empID = '" + hidEmployeeEditIndex.Value + "'");
// cmd.Connection = conn;
// cmd.ExecuteNonQuery();
// Bind(this.TextBox1.Text);

//}



protected void btnSaveEmployee_Click(object sender, EventArgs e)
{

// txtFirstName.Text = "SDFSD";
// first.Value = txtFirstName.Text;



//first.Value = Pa
first.Value = txtFirstName.Text;
//last.Value = txtLastName.Text;
//social.Value = txtsocial.Text;
//department.Value = txtdepartment.Text;
//address.Value = txtaddress.Text;
//phone.Value = txtphone.Text;
//applicationDate.Value = txtappdate.Text;


}
protected void txtFirstName_TextChanged(object sender, EventArgs e)
{


}
}

Hirajivisa84 ,

One solution is to register hidden fields and set those fields in a javascript function. That javascript function would be tied to your OnOkScript attribute of your ModalPopupExtender and so would be called whenever your OkControlId control is clicked. That javascript would set the hidden fields to the values of the fields in the modal popup.

Later, you can click a button that fires the code-behind handler that would read those hidden fields.

Here is an example that works:

<%@.PageLanguage="C#"AutoEventWireup="true"Codebehind="Default.aspx.cs"Inherits="AJAXEnabledWebApplication1._Default" %>

<%@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <htmlxmlns="http://www.w3.org/1999/xhtml">

<headid="Head1"runat="server">

<title>Untitled Page</title> </head>

<bodystyle="background-color: transparent">

<formid="form1"runat="server">

<asp:ScriptManagerID="ScriptManager1"runat="server"/>

<div>

</div>

<asp:ButtonID="Button1"runat="server"Style="position: absolute; left: 119px; top: 322px;"

Text="Show Popup"Width="86px"/><asp:ButtonID="Button2"runat="server"Style="position: absolute; left: 277px; top: 198px;"

Text="Read Hidden Value"Width="137px"OnClick="Button2_Click"/>

<cc1:ModalPopupExtenderID="ModalPopupExtender1"runat="server"PopupControlID="Panel1"

TargetControlID="Button1"OkControlID="OkButton"CancelControlID="CancelButton"OnOkScript="SaveTextBoxValue()">

</cc1:ModalPopupExtender>

<asp:PanelID="Panel1"runat="server"Height="183px"Width="199px"Style="left: 36px;

position: absolute; top: 123px"BackColor="#C0FFFF">

<asp:TextBoxID="TextBox2"runat="server"></asp:TextBox>

<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox>

<asp:ButtonID="CancelButton"runat="server"Text="Cancel"/>

<asp:ButtonID="OkButton"runat="server"Text="Ok"/></asp:Panel>

<asp:LabelID="Label1"runat="server"Text="Label"style="left: 302px; position: absolute; top: 160px"></asp:Label>

</form> </body>

</html>

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

namespace AJAXEnabledWebApplication1

{

publicpartialclass_Default : System.Web.UI.Page

{

protectedvoid Page_Load(object sender,EventArgs e)

{

string hiddenValue ="initial value";

Page.ClientScript.RegisterHiddenField("myHiddenField", hiddenValue);

string clientScript =

"<script type=\"text/javascript\"> "

+" function SaveTextBoxValue()"

+" { "

+" document.getElementById(\"myHiddenField\").value = document.getElementById(\"TextBox2\").value;"

+" } "

+"</script>";Page.ClientScript.RegisterClientScriptBlock(typeof(_Default),"MyClientScript", clientScript,false);

}

protectedvoid Button2_Click(object sender,EventArgs e)

{

Label1.Text = Request.Form["myHIddenField"];

}

}

}

In the Page_Load function we register the hidden field "myHiddenField" and also the javascript.

On the page is a Button2 labeled "Read Hidden Value" that when clicked will fire the codebehind to read the registered hidden field into Label1. In your case I think you want to save those values to several variables, which you can do at Button2_Click event handler, or something similar.

Pete


Hi Pete,

thanks for your reply.

first I tried your sample.But I get only theinitial value.I dont know what is the problem really.and Please tell me i need to get the textbox values from PopupWindow when i press the ok button.

Raji


atcually i got the values from gridView for Textbox using the below code.

protected void CommandButton_OnSelect(object sender, EventArgs e)
{

ImageButton btnEdit = sender as ImageButton;


GridViewRow row =(GridViewRow) btnEdit.NamingContainer;
txtFirstName.Text = row.Cells[1].Text;
txtLastName.Text = row.Cells[2].Text;
txtsocial.Text = row.Cells[3].Text;
txtdepartment.Text = row.Cells[4].Text;
txtaddress.Text = row.Cells[5].Text;
txtappdate.Text = row.Cells[7].Text;
}

if i edit or not edit , i need to get the textbox's values from popupwindow for update my database.Please tell me for get the new Textbox values from popupwindow using atlas PopupExtender?? I tried the below for get the TextBox values but i got only null value.I need to get the values correctly.

in aspx:

btnSaveEmployee is for PopupWindow Button :

<asp:Button ID="btnSaveEmployee" runat="server" Text="Save" UseSubmitBehavior="False" CausesValidation="true" OnClick="btnSaveEmployee_Click"/>

Modal PopupExtender :

<cc1:ModalPopupExtender ID="MyExtender" runat="server">
<cc1:ModalPopupProperties TargetControlID="btnhiddenemployee" PopupControlID="pnlEmployee"/>
</cc1:ModalPopupExtender>

Code behind :

protected void btnSaveEmployee_Click(object sender, EventArgs e)
{

// txtFirstName.Text = "SDFSD";
// first.Value = txtFirstName.Text;

first.Value = txtFirstName.Text;

//first.Value = Pa
// first.Value = txtFirstName.Text;
//last.Value = txtLastName.Text;
//social.Value = txtsocial.Text;
//department.Value = txtdepartment.Text;
//address.Value = txtaddress.Text;
//phone.Value = txtphone.Text;
//applicationDate.Value = txtappdate.Text;


}

the first ,last and etc are input hidden.

I need to get the new Values from PopupWindow in ModalPopupExtender.Help Me!!!!!!!!

Thanks

Raji

Thanks.

raji


Hi Raji,

I double checked the code posted, and it partially worked; i noticed when I hit the refresh button the label goes back to being the initial value. So here is an updated version of the codebehind:

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

namespace AJAXEnabledWebApplication1

{

publicpartialclass_Default : System.Web.UI.Page

{

protectedvoid Page_Load(object sender,EventArgs e)

{

Page.ClientScript.RegisterHiddenField("myHiddenField","");

string clientScript =

"<script type=\"text/javascript\"> "

+" function SaveTextBoxValue()"

+" { "

+" document.getElementById(\"myHiddenField\").value = document.getElementById(\"TextBox2\").value;"

+" } "

+"</script>";Page.ClientScript.RegisterClientScriptBlock(typeof(_Default),"MyClientScript", clientScript,false);

}

protectedvoid Button2_Click(object sender,EventArgs e)

{

string hiddenValue = Request.Form["myHiddenField"];

Label1.Text = hiddenValue;

}

}

}

Click on the "Show Popup" button. Type something into the top textbox in the modal popup. click ok. Click on "Read Hidden Value.", which will then show the new text you typed in.

Also, I'm not using the Atlas toolkit at all, only the AjaxControlToolkit version 1.0. And I'm not using "input" HTML tags of type hidden either, just registering hidden fields and reading them in the codebehind.

Pete


hi pete

I tried ur post but i didnt get a result.bec i got sys is undefined error.( using IE 7). however my requirement is also till not solved.

I used atlas ModalPopupExtender for GridView.In textBox i choose anyone item,that related fields displayed in the GridView.In this GridView I have used

Atlas ModalPopupExtender.if i click anyone of the row edit button the corresponding particular row values displayed in all the textbox's in popwindow.

but if i edit the textbox values and after clicking the ok button in the popupwindow I got only the null values.(The code is shown above).my requirement is i need to retrieve that new values from the Popupwindow.bec it helpful for update my database and also update the GridView.

Please help me or anyone knows help me!!!!

Raji



Hi,

I dont know whether your problem is solved. But for you reference i suggest you to gohttp://www.aspdotnetcodes.com/Ajax_ModalPopup_PostBack_GridView.aspx . this article explains the modalpopup in gridview, also with fine source code and example .

thanks