I have a WebGrid that has a "Row_ID" field. The field is a hyperlink. When the user clicks on this field, I want it to open the WebDialogWindow and that WebDialogWindow will have a grid of some sort that is attached to a SQLDataSource that will pull certain information based on the value of the "Row_ID" field from the WebGrid. I'm just not sure how to go about doing this. The Row_ID field does not have to be a hyuperlink...if there is a better way of doing this...but I want the user to know that they can click on the field to see whis other information.
Instead of passing parameters and accessing by Request.QueryString, is it possible to get parameters by Request.Form in this example?
<script type="text/javascript"> function editrates(el) { var dlg = $find("dlgEditRates") dlg.get_contentPane().set_contentUrl("CarrierLedgerDetailEditRates.aspx?pub=" + el.getAttribute("pub") + "&routeid=" + el.getAttribute("routeid"); dlg.set_windowState($IG.DialogWindowState.Maximized); dlg.set_visible(true); } </script>
When you use above, QueryStrings can't have special characters? Otherwise, the above example works perfectly.
Do you have any suggestions/examples?
Thanks
don't think he plans to do it without a postback..
since the wdw with grid has to pull data based on the id..
Is it just me or is no one seeing the easy way out?
CHP.. put a tag on the click event of the grid row.. then grab the id field. pass it to a sub,, load your wdw, pass the id to your sqlcontrol and QED..
You basically have to grab the ID field value when the user clicks on the row or the cell.
grid_dblClick event would do fine for you..
..dgrid.DisplayLayout.ActiveRow.Selected = True yourvariablefieldname = grid.DisplayLayout.SelectedRows.Item(0).Cells(1).ToString()
then pass "yourvariablename" to whatever function or routine you have to show the wdw..assign the id, etc..
Hello,
Were you able to accomplish this using the code that was provided?
Let me know if I can be of any further assistance.
Sincerely,Duane
I understand the question differently... It sounds to me like the WebDataGrid and the WebDialogWindow are on the same page, and he wants to open the WebDialogWindow in the same page.
Further, it sounds like he'd like to do it without a postback.
Here is how I did something similar....
TemplateDataField with a literal:
<ig:TemplateDataField Key="btnedit"> <ItemTemplate> <asp:Literal ID="ltrRouteEdit" runat="server"></asp:Literal> </ItemTemplate> <Header Text="" /> </ig:TemplateDataField>
Inject some HTML into the Literal on the InitializeRow event
Protected Sub whdgSummary_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.Web.UI.GridControls.RowEventArgs) Handles whdgSummary.InitializeRow
Dim ltr As Literal
ltr = e.Row.Items(whdgSummary.Columns.FromKey("btnedit").Index).FindControl("ltrRouteEdit") Dim RouteId As Long = DataBinder.Eval(e.Row.DataItem, "RouteID") Dim pub As String = DataBinder.Eval(e.Row.DataItem, "pubcode") s = String.Format("<a alt='edit rates' " & _ "href='#' pub='{0}' routeid='{1}' " & _ "onclick='editrates(this); return false;'><img class='imgedit' src='images/edit.gif' " & _ "alt='Edit Rates' align='middle' />Edit Rates</a>", pub, RouteId) ltr.Text = s.ToString End Sub
Stick a javascript function into your page that will respond to the client-side click event, and load the WebDialogWindow
I placed my detail webgrid in another page and passed in the parameters to it in a querystring, just for simplicity. If you need to detect when the user closes the WebDialogWindow so that you can refresh your parent grid data, wrap the parent WebDataGrid in an update panel, attach a client event to the WebDialogWindow's "WindowStateChanged" event, and use the following javascript.
<script type="text/javascript"> function dlgEditRates_WindowStateChanged(sender, eventArgs) { if ($find("dlgEditRates").get_windowState() == $IG.DialogWindowState.Hidden) { __doPostBack("UpdatePanel1", ''); } } </script>
Hi,
You can pass the value from WebGrid as follows: (Please note that here I am assuming that WebDialogWindow is on different aspx page)
Your template control will look like this:igtbl:TemplatedColumn Key="LinkButton"> <CellTemplate> <asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click" CommandArgument="<%#Container.Cell.Row.Index%>">LinkButton</asp:LinkButton> </CellTemplate> <Header Caption="LinkButton" Title=""> </Header></igtbl:TemplatedColumn>
Now on your code behind, you use following code inside the click event of the LinkButton control:protected void LinkButton1_Click(object sender, EventArgs e) { LinkButton button = (LinkButton)sender; System.Diagnostics.Debug.WriteLine(String.Format("Button Clicked in row {0}", button.CommandArgument.ToString())); object value = this.UltraWebGrid1.Rows[int.Parse(button.CommandArgument)].Cells.FromKey("LinkButton").Value;
Response.Redirect("Default2.aspx?cell=" + value + ""); }
On your default2.aspx page(which contains the WebDialogWindow) you can use following code to get the value: string cell = Request.QueryString[0]; //now you can use this value as per your logic
I hope this will help you.Let me know if you have any questions with this matter.
NehaDeveloper Support EngineerInfragisticswww.infragistics.com/support