protected void grdDisplayRequest_RowDataBound(object sender, GridViewRowEventArgs e) { Dictionary<string, int> DictionaryCloumnName = Session["DictionaryCloumnName"] as Dictionary<string, int>;//Session containing the Column name and the Column ID. Dictionary<string, string> FKeyName = new Dictionary<string, string>(); FKeyName = Session["Fkeys"] as Dictionary<string, string>;//Session contain the list of ForeignKeys. string TableName = Session["OperatingTableName"] as string;//Session Contain the Selected Table Name. if (e.Row.RowType == DataControlRowType.DataRow)//Check whether RowType is DataRow , so that we can update the Rows of the GridView. { foreach (KeyValuePair<String, String> entry in FKeyName)//iterating the loop to get the Name of ForeignKey and Table related to that ForeignKey. { if (DictionaryCloumnName.ContainsKey(entry.Key))//Check for the ColumnName present in the Dictionary. { int i = DictionaryCloumnName[entry.Key];//Index of the ForeignKey Column. LinkButton link = new LinkButton(); link.Text = e.Row.Cells[i].Text;//Text of the Column who we want to convert to Link. link.CommandArgument = "onclick"; link.Attributes["onclick"] = "popwin('" + entry.Value + "');";//Adding attributes to the link button, adding the JavaScript Function name who will call the New Pop Window. e.Row.Cells[i].Controls.Add(link);//Adding the Row containing the LinkButton to the GridView. } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)