In the below code I have a datagrid, in which I have 2 columns userid
and documentid
and a button. I want to get that userid
of particular row, how can I do this?
<asp:DataGrid Width="100%" ID="DocumentUsergrid"
PagerStyle-Mode="NumericPages" PageSize="10" PagerStyle-Visible="true"
AllowPaging="true" AllowSorting="true"
AlternatingRowStyle-CssClass="alt">
<AlternatingItemStyle BackColor="White" />
<asp:TemplateColumn HeaderText="DocumentID" ItemStyle-Width="150px" Visible="false" >
<ItemTemplate>
<asp:Label ID="lblOutputProductID_i" runat="server" Text='<%#Eval("DocumentID") %>' > </asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="UserID" ItemStyle-Width="150px" Visible="false" >
<ItemTemplate>
<asp:Label ID="lblSupportProductID_i" runat="server" Text='<%#Eval("UserID") %>' > </asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Insert" ItemStyle-Width="150px">
<ItemTemplate>
<asp:Button ID="btnSubmit" runat ="server" OnClick="btnSubmit_Click" />
</ItemTemplate>
</Columns>
<HeaderStyle Font-Bold="True" ForeColor="White" />
<ItemStyle BackColor="#EFF3FB"/>
</asp:DataGrid>
protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
Dictionary<string, string> OutputProductVal = new Dictionary<string, string>();
OutputProductVal.Add("UserID", );//To get userid of particular row
OutputProductVal.Add("DocumentID", ddlDocumentName.SelectedValue.ToString());
DocumentServiceClient oProduct = new DocumentServiceClient();
oProduct.InsertUserDocumentMap(OutputProductVal);
}
}