How to open a model window on click on any row of datagrid?
Hi i want to open a model window on click on datagrid. Can it be possible??
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Niradhip ChakrabortyRank #429 · 5.8K reputationPosted Jun 26, 2008, 2:45 AM EDT
Say your datagrid id is : dgrdExhibitorInfo
public void dgrdExhibitorInfo_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.AlternatingItem ||
e.Item.ItemType == ListItemType.Item)
{
e.Item.Attributes.Add("onclick", "OpenWin(this)");
}
}
Niradhip ChakrabortyRank #429 · 5.8K reputationPosted Jun 26, 2008, 2:24 AM EDT
the java script function to open the page.
Milton Smith55 reputationPosted Jun 26, 2008, 2:31 AM EDT
Milton Smith55 reputationPosted Jun 26, 2008, 2:57 AM EDT
Niradhip ChakrabortyRank #429 · 5.8K reputationPosted Jun 26, 2008, 3:11 AM EDT
function OnMenuMouseOver(obj)
{
obj.style.cursor='hand';
}
call this javascript function on itemdatabound event.
public void dgrdExhibitorInfo_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.AlternatingItem ||
e.Item.ItemType == ListItemType.Item)
{
e.Item.Attributes.Add("onclick", "OpenWin(this)");
e.Item.Attributes.Add("onmouseover", "OnMenuMouseOver(this)");
}
}
Milton Smith55 reputationPosted Jun 26, 2008, 3:21 AM EDT