Hello dev648237923,
Regarding on the dropdownlist and textbox interact requirement, I think you
can use the GridView.RowCreated event to set script handler for the
DropDownList( the "onchange" client event). And at that time, you can get
the Textbox instance also and embed its "ClientID"(which represent its id
at client-side html) into your script function call. For example, suppose
you have a TemplateField in gridview as below:
==============================
.......................
<asp:TemplateField HeaderText="template column">
<ItemTemplate >
<asp

ropDownList ID="lstTest" runat="server" >
<asp:ListItem Text="aaa" Value="aaa"></asp:ListItem>
<asp:ListItem Text="bbb" Value="bbb"></asp:ListItem>
<asp:ListItem Text="ccc" Value="ccc"></asp:ListItem>
</asp

ropDownList>
<asp:TextBox ID="txtTest" runat="server">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
=======================
In GridView's RowCreated event, you can find the DropDownList and Textbox
and do some customization on them:
=======================
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow &&
e.Row.RowState == DataControlRowState.Normal)
{
DropDownList lst = e.Row.FindControl("lstTest") as
DropDownList;
TextBox txt = e.Row.FindControl("txtTest") as TextBox;
lst.Attributes["onchange"] =
"javascript:AdjustTextBox(this, '" + txt.ClientID + "');";
}
}
==================
Here is the client script functino
=============
<script type="text/javascript">
function AdjustTextBox(lst, txtid)
{
var txt = document.getElementById(txtid);
txt.value = lst.selectedIndex;
}
</script>
================
You can adjust the test code to fit your specific requirement. If you have
any further questions on this, please feel free to let me know.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.